[issue47257] add methods to get first and last elements of a range
Mark Dickinson
report at bugs.python.org
Fri Apr 8 06:13:09 EDT 2022
Mark Dickinson <dickinsm at gmail.com> added the comment:
> but it's messy and potentially tricky to get the actual first and last values of the range
Doesn't simple indexing already provide what you need here?
>>> range(1, 5, 2)[0] # first element of range
1
>>> range(1, 5, 2)[-1] # last element of range
3
----------
nosy: +mark.dickinson
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47257>
_______________________________________
More information about the Python-bugs-list
mailing list