[Python-ideas] Annotations (and static typing)
Andrea Censi
censi at mit.edu
Wed Aug 20 19:37:21 CEST 2014
On Wed, Aug 20, 2014 at 12:51 PM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
>> What can one do with an annotation that one cannot do with a decorator?
>
>
> Spell "returns" in two characters.
True. (Is there any alternative to using a "returns" argument in the decorator?)
We can also compile another list:
What can one do with a decorator that cannot be done with annotations?
1) Comment out type checking with one character.
(Admittedly, this is thinking short term --- it's a limitation of the
editors rather than the language itself. We can imagine that
language-aware editors of the future will be more flexible. For
example, the editor would have a shortcut to hide or disable type
annotations.)
2) Easily parse (with your eyes) the function signature without having
to think about types.
...
A.
More information about the Python-ideas
mailing list