On Tue, Jul 9, 2019 at 4:15 PM Andrew Barnert via Python-ideas <python-ideas@python.org> wrote:
On Jul 9, 2019, at 13:09, Shay Cohen <shayco@gmail.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
>>> __annotations__
{'a': 3}
>>> class X:
...     b: 42
...
>>> hasattr(X, 'b')
False
>>> X.__annotations__
{'b': 42}