[Python-3000] What's the point of annotations?

Phillip J. Eby pje at telecommunity.com
Tue Jan 2 20:19:05 CET 2007


At 08:13 PM 1/2/2007 +0100, BJörn Lindqvist wrote:
>On 1/2/07, Phillip J. Eby <pje at telecommunity.com> wrote:
>>At 12:08 PM 1/2/2007 -0600, Collin Winter wrote:
>> >I could say You Aren't Going to Need It, but that gets the tense
>> >wrong; we're getting along without annotations quite nicely here in
>> >the present. In short: I'd like to request that PEP 3107 be rejected
>> >as an overly-specific, unnecessary addition to the language.
>>
>>You left off overloading and argument adaptation as use cases.  These are
>>considerably more readable when specified in-line, just like decorators are
>>more readable placed above the function than after it.
>
>I don't understand. How does function annotations in itself make
>overloading and argument adaptation more readable? And with
>"overloading," do you mean function overloading? I thought that wasn't
>possible in Python and even if it was, it was a bad idea. The FAQ says
>something like that.

Please see the lengthy Python-3000 threads, and Guido's blog.

>  I'd like to see a before-and-after example.

@overload(int, str)
def foo(bar, baz):
     ...

@overload
def foo(bar: int, baz: str)
     ...



More information about the Python-3000 mailing list