[Python-ideas] Integrate some itertools into the Python syntax

Ethan Furman ethan at stoneleaf.us
Mon Mar 28 12:32:01 EDT 2016


On 03/28/2016 09:23 AM, Michel Desmoulin wrote:

> It would be possible but would basically be equivalent to
> list(arbitrary_iterable)[-10:] and would load everything in memory, at
> best rendering generators useless, at worst exploding on a infinite data
> stream.
>
> But I think it would be ok to raise ValueError any negative indices by
> default, and then let containers such as list/tuple define custom
> behavior for them.

Agreed.  And already the default behaviour.


> Also, what do you think about the callable passed as an index from the
> first examples ?

I like it, but it will be a pain to implement.  (At least, it would be 
for me. ;)

--
~Ethan~



More information about the Python-ideas mailing list