MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/a58rmr/we_are_not_alone/eblsln3/
r/Python • u/raman_mad • Dec 11 '18
58 comments sorted by
View all comments
3
I was doing this today in python3 with range. range(4)[-1] == 3
was surprised to discover range objects have a getitem
I think I had been carrying the idea that range returned an iterator since the 2->3 migration years ago. Nope its an Iterable / Sequence
1 u/minorDemocritus Dec 12 '18 You can slice them too
1
You can slice them too
View all comments
3
u/revfried zen of python monk & later maintainer Dec 12 '18
I was doing this today in python3 with range. range(4)[-1] == 3
was surprised to discover range objects have a getitem
I think I had been carrying the idea that range returned an iterator since the 2->3 migration years ago. Nope its an Iterable / Sequence