[Python-Dev] PEP 362 open issues

Brett Cannon brett at python.org
Thu Aug 24 00:59:39 CEST 2006


I have been spending my Google sprint time on writing and implementing PEP
362 (http://www.python.org/dev/peps/pep-0362/), which finally defines
Signature objects for functions.  With the implementation at a place I am
happy with, I wanted to ask about the open issues with the PEP.

The first question is whether  to have Signature objects on all functions by
default or to leave it in the 'inspect' module and have it be something
totally optional.  My vote is the latter for now and we can add them to all
functions if they turn out to be useful and popular.

The second open issue is how to handle binding arguments to tuple parameters
for the Signature.bind() method.  If you have the function ``def foo((a, b):
pass``, how do you have the Signature.bind() method handle 'a', and 'b'?
You can either take the proposed arguments and in the dict mapping arguments
to parameters have an entry for 'a' and 'b' individually, or have an entry
for '(a, (b,))'.  My vote is the latter since you cannot address 'a' or 'b'
individually as keyword arguments and this makes more sense with function
annotations since they won't apply to 'a' and 'b' individually but instead
to the entire tuple.  Either way there is the issue of exhausting an
iterator (like a generator) trying to find out if it is the proper length to
unpack, for which I raise a TypeError instead of exhaust a possibly mutable
iterator currently.

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060823/926f341c/attachment.htm 


More information about the Python-Dev mailing list