[Python-ideas] Annotations (and static typing)

Ethan Furman ethan at stoneleaf.us
Wed Aug 20 18:43:03 CEST 2014


On 08/20/2014 09:31 AM, Paul Moore wrote:
> On 20 August 2014 17:26, Ethan Furman <ethan at stoneleaf.us> wrote:
>> On 08/20/2014 09:04 AM, Guido van Rossum wrote:
>>>
>>> I expect that we'll find a way for type and other annotations to coexist
>>> [...]
>>
>> Another thing to keep in mind, and which my scription utility will probably
>> switch to, is that we are not stuck only with __annotations__ -- we can also
>> add other attributes, such as __scription__ or __plac__ or
>> __my_custom_stuff__ or whatever.
>>
>> It could easily be that coexisting means use a decorator instead of
>> annotations, and store the info in a different attribute.  As a bonus this
>> method is even 2.x compatible.
>
> The obvious thought is, if a decorator is a sufficiently good
> notation, is there any need for annotations at all (even for static
> typing)?

What can one do with an annotation that one cannot do with a decorator?

--
~Ethan~


More information about the Python-ideas mailing list