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
{{ message }}
Repository navigation
type redefinition allowed when value coming from dictionary #8123
The main example is a little hairy. The cause here is that the typeshed stub for get is def get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ....
If we changed the definition to the more obvious def get(self, k: _KT, default: _T) -> Union[_VT_co, _T]: ..., then I think this would work. That change did get made, but we had to revert it because it caused issues python/typeshed#2817.
I think our conclusion was that #6613 would allow doing that. So I am going to close this issue in favor of that one but add a note to it. Thanks!
Activity
msullivan commentedon Dec 10, 2019
The last example is certainly correct behavior.
The main example is a little hairy. The cause here is that the typeshed stub for
getisdef get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ....If we changed the definition to the more obvious
def get(self, k: _KT, default: _T) -> Union[_VT_co, _T]: ..., then I think this would work. That change did get made, but we had to revert it because it caused issues python/typeshed#2817.I think our conclusion was that #6613 would allow doing that. So I am going to close this issue in favor of that one but add a note to it. Thanks!
dpinol commentedon Dec 10, 2019
thank you guys, mypy is amazing