[Python-Dev] signature object issues (to discuss while I am out of contact)

Brett Cannon brett at python.org
Mon May 1 19:42:44 CEST 2006

Signature objects (which has been lightly discussed on python-3000,
but I realize should be retargeted to 2.6 since there is no
incompatibility problems) are the idea of having an object that
represents the parameters of a function for easy introspection.  But
there are two things that I can't quite decide upon.

One is whether a signature object should be automatically created for
every function.  As of right now the PEP I am drafting has it on a
per-need basis and have it assigned to __signature__ through a
built-in function or putting it 'inspect'.  Now automatically creating
the object would possibly make it more useful, but it could also be
considered overkill.  Also not doing it automatically allows signature
objects to possibly make more sense for classes (to represent
__init__) and instances (to represent __call__).  But having that same
support automatically feels off for some reason to me.

The second question is whether it is worth providing a function that
will either figure out if a tuple and dict representing arguments
would work in calling the function.  Some have even suggested a
function that returns the actual bindings if the call were to occur. 
Personally I don't see a huge use for either, but even less for the
latter version.  If people have a legit use case for either please
speak up, otherwise I am tempted to keep the object simple.

Now, I probably won't be participating in this discussion for the rest
of the week.  I am driving down to the Bay Area from Seattle for the
next few days and have no idea what my Internet access will be like. 
But I wanted to get this discussion going since it kept me up last
night thinking about it and I would like to sleep by knowing
python-dev, in its infinite wisdom <grin>, is considering the issues. 


More information about the Python-Dev mailing list