This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients eric.smith, gvanrossum, larry
Date 2021-01-10.11:29:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610278192.15.0.512262305909.issue42881@roundup.psfhosted.org>
In-reply-to
Content
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)?
History
Date User Action Args
2021-01-10 11:29:52larrysetrecipients: + larry, gvanrossum, eric.smith
2021-01-10 11:29:52larrysetmessageid: <1610278192.15.0.512262305909.issue42881@roundup.psfhosted.org>
2021-01-10 11:29:52larrylinkissue42881 messages
2021-01-10 11:29:52larrycreate