-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add Sequence to documentation #6536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
After some searching, it is documented at https://docs.python.org/3/library/typing.html#typing.Sequence and implemented at https://github.com/python/cpython/blob/3.7/Lib/typing.py#L1220 |
It's not listed as a Protocol because it's not actually a Protocol. There might be another place in the mypy docs where it could usefully be mentioned though. |
Yes, it is not a protocol. The remainder is essentially a duplicate of #31 |
Apologies for necro-posting, but why isn't it a protocol? The fact that it's not means you can't do something like: @typing.runtime_checkable
class HashableProtocol(
typing.Protocol[T_co], typing.Hashable, typing.Sequence[T_co]
):
pass |
@vectro, the reason the more complicated ABCs aren't protocols is that they don't just imply that specific method signatures exist, they imply behaviours that can't just be inferred. For instance if
|
Apologies in advance if I've failed to search the docs. As far as I can tell, Sequence isn't formally documented - it would fit quite nicely in Predefined Protocols I think.
I will look to make this change myself over the next couple of days, but I wanted to raise the issue first in case I had a complete fail with the docs.
The text was updated successfully, but these errors were encountered: