Shadows of built-in names "function" and "module" with PyCharm

I have the following Python code:

function = "Developer"
module = "something"
print(function + " on " + module)

Since PyCharm 2017, I have a bubble that says "Shadows of the built-in names" function "/" module with PyCharm ".

Im surprised because "function" and "module" are not built-in names. They are also not keywords:

import __builtin__
import keyword

assert "function" not in dir(__builtin__)  # -> OK
assert "module" not in dir(__builtin__)    # -> OK
assert "function" not in keyword.kwlist    # -> OK
assert "module" not in keyword.kwlist      # -> OK

What's wrong?

Im using CPython 2.7, but has the same problem with 3.5 and 3.6.

EDIT:

__builtin__now builtinsin Python 3.

+6
source share
2 answers

functiondefined in builtins.pyi:

class function:
    # TODO not defined in builtins!   
    __name__ = ...  # type: str
    __qualname__ = ...  # type: str
    __module__ = ...  # type: str
    __code__ = ...  # type: Any
    __annotations__ = ...  # type: Dict[str, Any] 

Keep in mind that I have used “specific” and specific. Check out this absurdity:

foo = function

promotions

Traceback (most recent call last):
  File "main.py", line 117, in <module>
    foo = function
NameError: name 'function' is not defined

function = 'a', IDE ( ), ( function ).

module.

, ( , -, , , ) pyi , ( PEP-484 ).

, , ​​Pycharm linter (, "" .pyi) .

, , , .

+7

Per PY-8672, 2014 . "", " ", "", , .

+1

All Articles