In addition to the other answers:

Libraries like NumPy define a helper factory for slices, e.g. 
```python
>>> import numpy as np
>>> np.s_[1:10]
slice(1, 10, None)
```

You can do the same in your library. Equally, you don't have to return a slice 
— you might want to return a "Range" object as mentioned by other posters. 

Personally, I don't think there needs to be a more concise syntax — people 
rarely need bare slice objects by themselves.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/UVVWF6ATUI7CC7NJJK7I45RPXQANKCYB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to