[Python-ideas] [Python-3000] PEP 3107 Function Annotations: overloadable ->

Guido van Rossum guido at python.org
Tue Jan 2 01:20:40 CET 2007

On 1/1/07, Tony Lownds <tony at pagedna.com> wrote:
> Is anyone against "->" overloadable as __returns__ /__rreturns__
> with no semantics for existing types?

I suggest that you question *really* *hard* whether it's worth it.
We'd be introducing two very different syntactic uses for '->'. I
chose this operator to signify function return annotation specifically
because it *does't* have another meaning in Python. (My first choice
would've been ':', which is mostly a delimiter that derives its
meaning from context, like ',', but that would've introduced too much
syntactic ambiguity.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-ideas mailing list