On 5 September 2016 at 23:46, Nick Coghlan <ncogh...@gmail.com> wrote: > Under such "parameter annotation like" semantics, uninitialised > variable annotations would only make sense as a new form of > post-initialisation assertion, and perhaps as some form of > Eiffel-style class invariant documentation syntax.
Thinking further about the latter half of that comment, I realised that the PEP 484 equivalence I'd like to see for variable annotations in a class body is how they would relate to a property definition using the existing PEP 484 syntax. For example, consider: class AnnotatedProperty: @property def x(self) -> int: ... @x.setter def x(self, value: int) -> None: ... @x.deleter def x(self) -> None: ... It would be rather surprising if that typechecked differently from: class AnnotatedVariable: x: int For ClassVar, you'd similarly want: class AnnotatedClassVariable: x: ClassVar[int] to typecheck like "x" was declared as an annotated property on the metaclass. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com