-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
#2602 caused this to behave differently in mypy Python 2 and 3 modes:
reveal_type(['a', {'b'}])
In Python 2 mode it shows this:
Revealed type is 'builtins.list[typing.Sized*]'
In Python 3 mode it shows this:
Revealed type is 'builtins.list[typing.Collection*[builtins.str]]'
Before the PR Python 2 behavior was closer to Python 3:
Revealed type is 'builtins.list[typing.Iterable*[builtins.str]]'
This change causes regressions for mypy users, since the old type was more precise. More generally, any change in the MROs of built-in types has a significant chance of generating regressions and should be tested carefully.
Not sure what's the best way to move forward. I'd prefer getting Python 2 and Python 3 to be more similar if possible. Maybe we don't need to include Sized
explicitly in the MRO since it's a protocol? Again, this could have unforeseen results.
cc @gvanrossum
Metadata
Metadata
Assignees
Labels
No labels