New submission from Larry Hastings <la...@hastings.org>:
PEP 484 says: (Note that the return type of __init__ ought to be annotated with -> None. The reason for this is subtle. [...] https://www.python.org/dev/peps/pep-0484/#the-meaning-of-annotations If you follow this advice, then call typing.get_type_hints() on your __init__ function, you'll find it has turned "None" into "type(None)". git blame suggests get_type_hints' behavior was in the initial checkin of typing.py (46dbb7d1032c19163f37785509b8f5b3004416e8). So it's always behaved this way. Is "None" still considered the correct return annotation of an __init__? If so, should typing.get_type_hints() really be changing it to type(None)? ---------- components: Library (Lib) messages: 384760 nosy: eric.smith, gvanrossum, larry priority: low severity: normal stage: test needed status: open title: Should typing.get_type_hints change None annotations? type: behavior versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42881> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com