-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
When typechecking the following file, we give an error:
$ cat /tmp/foo.py
def f(foo):
if foo is not None:
dumps = foo.dumps
else:
from json import dumps
$ mypy /tmp/foo.py
/tmp/foo.py: note: In function "f":
/tmp/foo.py:5: error: Name 'dumps' already defined
Because the function f
doesn't have a type annotation, we ought to let this code be without complaining about it -- that makes it easier to start using mypy in parts of a large file, and pay the cost of fixing up code like this to work with mypy incrementally.
(Thanks to @varenc for reporting this issue -- he tried putting an annotation on one new function in a 3kLOC file with 188 existing functions, and it had this one error which stopped him.)
gvanrossum
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong