In Chris Rebert
writes:
>Take a look at inspect.getargspec(func):
>http://docs.python.org/library/inspect.html#inspect.getargspec
Thank you much, that did the trick. And inspect is a very handy
module to know about.
kynn
--
NOTE: In my address everything before the first period is backwards
norseman wrote:
Scott David Daniels wrote:
kj wrote:
Suppose that f is an object whose type is 'function'.
Is there a way to find out f's list of formal arguments?...
I can write a wrapper now:
def tracer(function):
def internal(*args, **kwargs):
print('calling %s(%s)'
Scott David Daniels wrote:
kj wrote:
Suppose that f is an object whose type is 'function'.
Is there a way to find out f's list of formal arguments?
The reason for this is that I'm trying to write a decorator and
I'd like the wrapper to be able to check the number of arguments
passedbut I'm
kj wrote:
Suppose that f is an object whose type is 'function'.
Is there a way to find out f's list of formal arguments?
The reason for this is that I'm trying to write a decorator and
I'd like the wrapper to be able to check the number of arguments
passed. Specifically, I'd like the wrapper
On Thu, May 14, 2009 at 12:31 PM, kj wrote:
>
>
> Suppose that f is an object whose type is 'function'.
>
> Is there a way to find out f's list of formal arguments?
>
> The reason for this is that I'm trying to write a decorator and
> I'd like the wrapper to be able to check the number of argument
kj wrote:
Suppose that f is an object whose type is 'function'.
Is there a way to find out f's list of formal arguments?
The reason for this is that I'm trying to write a decorator and
I'd like the wrapper to be able to check the number of arguments
passedbut I'm missing something like the
You can pull it out of f.func_code.co_varnames, but I don't believe
that's a very good approach. I tend to veer away from code objects
myself.
If you know how many arguments are passed into the wrapped function
when it's defined, you can write a function that returns your
decorator. As an example.
Suppose that f is an object whose type is 'function'.
Is there a way to find out f's list of formal arguments?
The reason for this is that I'm trying to write a decorator and
I'd like the wrapper to be able to check the number of arguments
passed. Specifically, I'd like the wrapper to look as