Uh oh!
There was an error while loading. Please reload this page.
Stop inheriting Sized in collection ABCs - #2658
Conversation
Instead define abstract __len__ in affected classes. Fixes#2655 without breaking rominf/ordered-set-stubs#1
Uh oh!
There was an error while loading. Please reload this page.
| def __len__(self) -> int: ... | ||
| class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]): | ||
| class Sequence(Iterable[_T_co], Container[_T_co], Reversible[_T_co], Generic[_T_co]): |
There was a problem hiding this comment.
Maybe preserve _Collection here, as otherwise mypy could infer a less precise type for some type joins? Then you could leave out __len__ as it would be inherited.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
srittau
commented
Nov 30, 2018
You declare |
JukkaL
commented
Nov 30, 2018
Some of the ABCs define various concrete methods that can act as default implementations. |
To incorporate python/typeshed#2658
To incorporate python/typeshed#2658
Instead define abstract __len__ in affected classes. Fixespython#2655 without breaking rominf/ordered-set-stubs#1
Instead define abstract len in affected classes.
Fixes#2655 without breaking
rominf/ordered-set-stubs#1