[Python-3000] Draft pre-PEP: function annotations

Paul Prescod paul at prescod.net
Tue Aug 15 00:48:33 CEST 2006


On 8/14/06, Collin Winter <collinw at gmail.com> wrote:
>
> Because not having standardised meanings at the same time as the
> feature becomes available says to developers, "don't use the built-in
> types in your annotations because we might give them a meaning
> later...or maybe we won't...but in the meantime, you're going to need
> to invent new spellings for lists, tuples, dicts, sets, strings, just
> in case". As someone writing an annotation consumer, that comes across
> as an incredibly arbitrary decision that forces me to do a lot of
> extra work.


No, you aren't going to have to invent new spellings.  As per my previous
email, this should be allowed:

def myfunc( NumTuples: [typepackage1(tuple(int)),
                       typepackage2("tuple(Number+))")]):...

All you need to do is declare the fact that you are using the built-in types
in a non-standard way by wrapping them in your own annotation constructor.

 Paul Prescod
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20060814/206991d8/attachment.html 


More information about the Python-3000 mailing list