1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Is this PyCharm-inspection a false positive? "Cannot find reference '__class__' in...

Discussão em 'Python' iniciado por Stack, Setembro 18, 2025.

  1. Stack

    Stack Membro Participativo

    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.

    Continue reading...

Compartilhe esta Página