-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add support for tuple slices. #895
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
Conversation
Apparently python happily accepts any slice, even if its out of range (and just gives an empty tuple). Personally, I find that behavior weird, but I opted to not check any ranges because python itself doesn't care.
Looks like you're missing |
Homogenous tuples (of either kind) should support non-literal slices. |
No they shouldn't, you lose the length of the tuple if you don't have a literal slice. I can see an argument for them resolving to variable-length tuples, but I dislike it. I don't mind having homogenous tuples work with arbitrary slices, though. I'll probably get homogenous tuples working tomorrow, I thought it would be simple but for some reason its treating it like not-a-tuple... |
It was really screwy to me at first, how the type shows up internally as |
Cool, thanks for the PR! Slicing of Slicing homogeneous, fixed-length tuples like One another thing would be nice to support: negative literal int in slice (e.g., |
FYI I was seeing mypy crash failing to locate the name |
That's because of #890 |
Apparently python happily accepts any slice, even if its
out of range (and just gives an empty tuple). Personally,
I find that behavior weird, but I opted to not check any
ranges because python itself doesn't care.
#886