[Python-ideas] built-in argspec for function objects

Terry Reedy tjreedy at udel.edu
Sun Jan 27 02:51:39 CET 2013


On 1/26/2013 6:27 PM, nbv4 wrote:
> def my_function(a, b=c):
>      pass
>
>  >>> my_function.args
> ['a']
>  >>> my_function.kwargs
> {'b': c}
>  >>> my_function.all_args
> ['a', 'b']
>
> What do you all think? Argspec is kind of unwieldy, this I think looks a
> lot nicer.

The argument specifications are attributes of code objects. The inspect 
functions, including the new signature function, are one way to pull 
them out. You can write you own if you wish. I do not think they should 
be duplicated on function objects.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list