On Thu, Dec 12, 2019 at 5:29 AM Siddharth Prajosh <[email protected]>
wrote:

> Can we have an extra function for lists and string (and wherever slicing
> works) to explicitly mention that we're slicing?? Something like - 
> *s=list(range(100));
> s.slice(10, 20).*
>

This exists already as ``itertools.islice`` and, to some extent,
``operator.itemgetter``.
https://docs.python.org/3/library/itertools.html#itertools.islice
https://docs.python.org/3/library/operator.html#operator.itemgetter

As a bonus, ``islice`` is more efficient in many situations.
_______________________________________________
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/QJVNDJ6DH3GOGF7WFVSVILDI2O32DZWQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to