[Python-Dev] Python Library Addition: First-class Procedure Signatures (original) (raw)

Collin Winter collinw at gmail.com
Wed Nov 14 20:41:42 CET 2007


On Nov 14, 2007 10:30 AM, Isaac Morland <ijmorlan at cs.uwaterloo.ca> wrote:

For another project (see my previous email on named tuples), I needed to represent procedure signatures, and use them to expand arguments into the dictionary of values that exists when execution of a procedure starts. To my surprise, this capability didn't seem to be provided by the Python library, even though it clearly is present within the Python system somewhere.

So I wrote a Signature class. Instances of the class represent all the information present between the parentheses of a procedure definition. Properties are provided to get the information out, and an expandargs method can be called to expand arguments into a dictionary. This expandargs method implements (if I've done it right) the argument conversion part of section 5.3.4 of the Python Reference Manual (http://docs.python.org/ref/calls.html).

Have you seen http://www.python.org/dev/peps/pep-0362/? It sounds awfully similar to what you're proposing here.

Collin Winter



More information about the Python-Dev mailing list