[Python-Dev] Python Library Addition: First-class Procedure Signatures (original) (raw)
Brett Cannon brett at python.org
Fri Nov 16 19:13:34 CET 2007
- Previous message: [Python-Dev] Python Library Addition: First-class Procedure Signatures
- Next message: [Python-Dev] Python Library Addition: First-class Procedure Signatures
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Nov 15, 2007 12:48 PM, Steven Bethard <steven.bethard at gmail.com> wrote:
On Nov 14, 2007 1:18 PM, Brett Cannon <brett at python.org> wrote: > On Nov 14, 2007 10:30 AM, Isaac Morland <ijmorlan at cs.uwaterloo.ca> wrote: > > 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). > > As Collin already pointed out, it sounds like you want PEP 362 to get > into the stdlib. I have not made a big push to try to get my existing > implementation into Python 2.6/3.0, but I plan to at some point.
Every time I read PEP 362, I get lost in the details. When you get around to working on it again, could you add a bunch of examples? That would make it much easier to tell why we want all those objects and attributes.
You might not need them in general. It just re-packages all the information that is found between a function object and a code object into a single location.
FWIW, Isaac's version of bind() that returns a regular str->object dict is all I've ever needed in my own code.
That's what the implementation does at the moment (if I remember correctly).
I am about to bundle up the code and submit to PyPI to get feedback from folks and to just get it out there instead of languishing in the sandbox while I try to decide exactly what to do about the open issues. I will see if i can toss in some examples into the PEP.
-Brett
- Previous message: [Python-Dev] Python Library Addition: First-class Procedure Signatures
- Next message: [Python-Dev] Python Library Addition: First-class Procedure Signatures
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]