Linked Questions

Popular Questions

In my codebase there is some amount of None.__class__. PyCharm marks this as as a warning:

Cannot find reference '__class__' in 'None'

I am using PyCharm 2022.3 (Community Edition) if that matters.

However, when I try it out in REPL I get this sensible output which seems to be consistent across different python versions (including Python 2.7 and Python 3.10) from what I have tried:

>>> None.__class__
<type 'NoneType'>

Is there a hidden danger I am not seeing? The documentation https://docs.python.org/3/library/constants.html#None seems to suggest NoneType is a proper part of the language and not some implementation-quirk.

Related Questions