[Python-ideas] Integrate some itertools into the Python syntax
Terry Reedy
tjreedy at udel.edu
Wed Mar 23 18:32:38 EDT 2016
On 3/22/2016 4:03 PM, Andrew Barnert via Python-ideas wrote:
> Range is a sequence, just like list and tuple, not an iterator, like
> generator and list_iterator. So it supports slicing because sequences
> generally support slicing. Not because it's so convenient and
> expressive that it's worth making a special case, just because it
> follows the normal rules.
>
> It's amazing to me that so many people still describe xrange/3.x
> range as an iterator or generator, and then draw further incorrect
> lessons from that.
An example I recently ran across is
http://python4kids.brendanscott.com/2016/03/19/python-for-kids-python-3-project-2/
Python4Kids uses range-as-list for the 2.x version. For the 3.x
version, he is agonizing over explaing 'range-as-generator'.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list