Eric V. Smith <[email protected]> added the comment:
Notice that this isn't just for __init__ or return types, it happens with any
annotations (here, with 3.8):
>>> def g(i: None): pass
...
>>> g.__annotations__
{'i': None}
>>> get_type_hints(g)
{'i': <class 'NoneType'>}
>>>
I just noticed that PEP 484 also says:
https://www.python.org/dev/peps/pep-0484/#using-none
"When used in a type hint, the expression None is considered equivalent to
type(None)."
But I find it odd that get_type_hints would make this determination for you.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42881>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com