On Thu, Jan 21, 2021, at 19:19, Chris Angelico wrote:
> Yeah, I don't think that'll work if you slice more than once,
> especially with some iteration in between.

I think part of the point of this implementation [or the other person's 
suggestion of having a "collection view", which amounts to the same thing] is 
that iterating wouldn't consume items anymore. Which does make it incompatible 
with enumerate currently returning an iterator, though, in situations where the 
iteration is dropped and picked up again.

> The precise semantics for mixing iteration and slicing are complex
> enough and variable enough that you may as well just go for a concrete
> list at that point.

I do think it's possible to have well-defined semantics [next() could simply 
return self[0] and increment a value to be added to input indices], but it's 
probably not worth it. I'd say this and e.g. similar map/zip functions belong 
in a "sequencetools" module rather than replacing the builtin, so that 
compatibility in these situations doesn't need to be maintained.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/D67HZZ2QX22SZ427Y6UKAB44UHIKHTL3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to