Uh oh!
There was an error while loading. Please reload this page.
Collection is Sized - #8977
Conversation
hauntsaninja
left a comment
There was a problem hiding this comment.
Hm, the decision not to implement Sized in Collection seems pretty intentional.
Looks like this goes back to #2658 , and was maybe done for Python 2 reasons?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
srittau
left a comment
There was a problem hiding this comment.
Considering that primer does not complain and the change back in 2018 alludes to Python 2/3 problems or problems that may be fixed in mypy 0.650, this looks good to me. But maybe @gvanrossum has some recollection about this?
sobolevn
commented
Oct 25, 2022
Or @JukkaL :) |
JukkaL
commented
Oct 25, 2022
This change seems fine, since the original motivation was Python 2/3 compatibility concerns, and the mypy primer output is clean. |
sobolevn
commented
Oct 25, 2022
I think that it is a good idea to copy original samples to our test cases. |
pyright has a different opinion: Ok, a test case won't quite work. But, here's my manual test case for this: |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
hauntsaninja
commented
Nov 1, 2022
Looks like this change breaks mypy: python/mypy#13977 Reproduce with e.g. The two quickest fixes are either: or: Which do people prefer? |
JelleZijlstra
commented
Nov 1, 2022
I'd prefer removing the metaclass, I don't think we need it there. |
jab
commented
Nov 29, 2022
I think this change caused a false positive error that I'm seeing. More info in #9296. |
This reverts commit 5bbba5d.
See https://github.com/python/cpython/blob/ad1dc3ebb6aadaeeeacde13d4ed2d62bf302bf62/Lib/_collections_abc.py#L431