Using arguments in a decorator

Rotwang sg552 at hotmail.co.uk
Sat Apr 21 10:15:53 EDT 2012


On 20/04/2012 16:57, I wrote:
> [...]
>
> But I don't know how. I know that I can see the default arguments of the
> original function using func.__defaults__, but without knowing the
> number and names of func's positional arguments (which I don't know how
> to find out)

Although the existence of inspect.getcallargs() has rendered this latter 
question moot for my purposes, in case anyone cares I've just noticed 
that the above information can be found by using 
func.__code__.co_argcount and func.__code__.co_varnames.


-- 
Hate music? Then you'll hate this:

http://tinyurl.com/psymix



More information about the Python-list mailing list