[Python-ideas] built-in argspec for function objects
Nick Coghlan
ncoghlan at gmail.com
Sun Jan 27 06:26:30 CET 2013
<I wish the Google Groups bridge would quit corrupting the reply-to fields>
On Sun, Jan 27, 2013 at 3:24 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Sun, Jan 27, 2013 at 9:27 AM, nbv4 <nbvfour at gmail.com> wrote:
>> def my_function(a, b=c):
>> pass
>>
>>>>> my_function.args
>> ['a']
>>>>> my_function.kwargs
>> {'b': c}
>>>>> my_function.all_args
>> ['a', 'b']
>
> Those are parameters, not arguments (see
> http://docs.python.org/3/faq/programming.html#faq-argument-vs-parameter)
>
>> What do you all think? Argspec is kind of unwieldy, this I think looks a lot
>> nicer.
>
> Indeed, argspec is unwieldy, which is why Python 3.3 includes the new
> inspect.signature function to calculate a richer signature
> representation that is easier to process:
> http://docs.python.org/3/library/inspect#introspecting-callables-with-the-signature-object
>
> Aaron Illes has backported this feature to earlier Python versions as
> the "funcsigs" PyPI package: http://pypi.python.org/pypi/funcsigs
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list