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

Brett Cannon brett at python.org
Sat Nov 17 05:26:37 CET 2007


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.

Done. I tossed up an annotations duck typing checker in the PEP.

FWIW, Isaac's version of bind() that returns a regular str->object dict is all I've ever needed in my own code.

My implementation does that as well. It was a typo in the PEP that said bind() returned Parameter objects as values.

-Brett



More information about the Python-Dev mailing list