On Jul 9, 2019, at 13:09, Shay Cohen <email@example.com> wrote:
> >>> a: 3
The reason this isn’t a syntax error is that Python allows any valid expression as an annotation. And “3” is just as valid an expression as “int”.
More generally, annotations don’t actually do anything at runtime, except get stored in an annotation dictionary.
If you're curious where those annotation "definitions" actually disappear off to: `__annotations__`
>>> a: 3
>>> class X:
... b: 42
>>> hasattr(X, 'b')