[Python-3000] PEP 3107 - Function Annotations

Neal Norwitz nnorwitz at gmail.com
Thu Dec 28 07:53:26 CET 2006

I checked in a modified version of the patch (rev 53170).  Mostly I:
 * added error checking
 * updated N_TOKENS in Include/token.h (and Lib/token.py) since a
token was added
 * Changed some code in Lib/compiler/pycodegen.py (I couldn't let
Guido see a 2-space indent or he might think Google had corrupted you
 * Made "return" an interned string

Some outstanding questions I have:

 * Should annotations be allowed to be a subclass of dict?
   (currently subclasses of dicts are allowed, but generic mappings are not)
 * With the modification of MAKE_FUNCTION to be a 32-bit value, this
means that EXTENDED_ARG is now used.  This means that the peephole
optimizer won't work for the outer function.  I think we should
correct this.
 * I don't understand why there was a new annotations (flag) parameter
added in symtable.  My guess was that this was to support lambdas
without annotations.  If this is true, it would be nicer if we didn't
have to special case.  I think there was talk about requiring parens
around lambda params.  I don't recall the outcome though.
 * We should update doc

Tony, you cleaned up quite a few places in the AST, care to do more
cleanup?  I liked your refactorings.

I also don't love all the names in Grammar.  Guido had mentioned about
cleaning up the Grammar.  I don't know if he still wants to or if it
can be improved.  It would be nice once all the basic features are in
if we could make a cleanup pass for things like Grammar, obsolete
APIs, etc.


On 12/27/06, Neal Norwitz <nnorwitz at gmail.com> wrote:
> On 12/27/06, Tony Lownds <tony at pagedna.com> wrote:
> >
> > On Dec 27, 2006, at 5:31 PM, Guido van Rossum wrote:
> >
> > > I just noticed that PEP 3107 has quietly been checked in. Thanks
> > > Collin and Tony!
> >
> > Ok, updated (and sent to Neal for checkin, thanks Neal!)
> I just checked in a slightly modified version from what you sent me in
> private mail.  Hopefully that was the same version as what was sent to
> the list.
> I made a few grammatical changes.  That was all.  For the next update
> can you pull down the changes from svn.  Also verify I checked in the
> correct version.
> I'll be looking at the patch and hopefully check that in soon.
> Was I supposed to give you svn access?  Sorry if I forgot.  Did you
> send you ssh keys to pydotorg?  I'm not sure I know how to give access
> to the PEPs, but I can try to give you access if you send your keys
> (as an attachment).
> n

More information about the Python-3000 mailing list