[Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484
Sven R. Kunze
srkunze at mail.de
Thu Aug 4 11:07:07 EDT 2016
On 04.08.2016 15:32, Steven D'Aprano wrote:
> I would think that annotations on local variables should not
> beevaluated or stored.
> I think it is reasonable to have annotations on global variables (or
> inside a class definition) stored somewhere for runtime analysis, like
> function annotations.
I don't know. That somehow would break expected Python semantics and
would lead to big asymmetry. Most people don't think about the
difference between module-level variables and variables in functions.
Their code works regardlessly.
The more I think about it, the more I like #comment-style annotations
then. They are a clear sign to the developer >not at runtime<, and only
available for static analysis.
This might even be true for class/instance variables.
--
Sven
More information about the Python-ideas
mailing list