-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Shouldn't a slice of a bytestring be a bytestring? #9080
Comments
Don't use ByteString, it's basically useless. It declares no methods. The behavior you see is because |
Ok. Mine was an attempt to replace the homegrown I guess we'll keep our |
Yeah, would love to see the back of ByteString python/cpython#91896 |
In typeshed we have our own Buffer alias with a bunch more types: https://github.com/python/typeshed/blob/main/stdlib/_typeshed/__init__.pyi#L236. You can use it at type checking type ( |
Slicing bytes, bytearray, memoryview objects, the result is an object of the same type.
However, slicing ByteArray, mypy complains:
Tested with mypy 0.982, 0.990 (from git).
Is this a typeshed shortcoming?
The text was updated successfully, but these errors were encountered: