Skip to content
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

More concise reprs for Slice #152

Open
asmeurer opened this issue Apr 6, 2023 · 0 comments
Open

More concise reprs for Slice #152

asmeurer opened this issue Apr 6, 2023 · 0 comments

Comments

@asmeurer
Copy link
Member

asmeurer commented Apr 6, 2023

Currently Slice always prints all three arguments, even if only one or two are needed to create it:

>>> Slice(None)
Slice(None, None, None)
>>> Slice(0, 10)
Slice(0, 10, None)

these could be printed more concisely as Slice(None) and Slice(0, 10).

We should also fix the printing of slice in Tuples so that something like Tuple(slice(None), slice(0, 10)) prints as such instead of Tuple(slice(None, None, None), slice(0, 10, None)).

(note, printing slices using : notation is a separate issue. This would be useful, but is only valid inside of an index expression so it should be done in a separate method)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant