[Python-3000] PEP 3107 - Function Annotations (original) (raw)

Neal Norwitz nnorwitz at gmail.com
Thu Dec 28 02:49:11 CET 2006


Some of these have already been fixed in a version sent to me. I need to check that version in. I haven't reviewed it, but I believe it addresses the signature issue. I should have time to get this in tonight.

n

On 12/27/06, Guido van Rossum <guido at python.org> wrote:

I just noticed that PEP 3107 has quietly been checked in. Thanks Collin and Tony!

After skimming it, I have one observation: the grammar in the PEP doesn't match that implemented by Tony's patch. The difference is only apparent for tuple-unpacking parameters (e.g. b and c in "def foo(a, (b, c), d): pass"). The PEP supports this syntax: def foo((a, b): "something"): ... while the patch supports this instead: def foo((a: "something", b: "somethingelse")): ... (I have to say that I like the patch version better. :-) I also note that the PEP uses foo.signature.annotations to access the annotations dict, while the patch uses foo.funcannotations. This is reasonable since we don't have the signature API yet (it's PEP 362, but I don't know its status). Finally, the PEP uses Number, Mapping and Sequence as example annotations. I'd rather not use those since they could incorrectly convey the notion that annotations imply type checking semantics, which thety don't (at least not without some kind of decorator). -- --Guido van Rossum (home page: http://www.python.org/~guido/)


Python-3000 mailing list Python-3000 at python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/nnorwitz%40gmail.com



More information about the Python-3000 mailing list