You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
map should be builtins.map, not MyClass.map and type should be builtins.type, not MyClass.type
Actual Behavior
method type issue.py:4: error: Function "method type issue.MyClass.map" is not valid as a type [valid-type]
method type issue.py:4: note: Perhaps you need "Callable[...]"
or a callback protocol?
method type issue.py:4: error: Function "method type issue.MyClass.type" is not valid as a type [valid-type]
Found 2 errors in 1 file (checked 1 source file)
The type is taken from the class methods. If I wanted to use the class methods I'd do
(which aren't valid types anyway)
Of course I should use a different name for methods to begin with, but unfortunately I don't have control over that in a type stub.
Your Environment
Mypy version used: 0.990 (compiled: yes)
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Python version used: 3.9.13
The text was updated successfully, but these errors were encountered:
Bug Report
Naming a method the same as an existing type will override existing type when later referenced.
To Reproduce
Expected Behavior
map
should bebuiltins.map
, notMyClass.map
andtype
should bebuiltins.type
, notMyClass.type
Actual Behavior
The type is taken from the class methods. If I wanted to use the class methods I'd do
(which aren't valid types anyway)
Of course I should use a different name for methods to begin with, but unfortunately I don't have control over that in a type stub.
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: