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

Chris Angelico rosuav at gmail.com
Mon Mar 28 11:04:55 EDT 2016


On Tue, Mar 29, 2016 at 1:45 AM, Franklin? Lee
<leewangzhong+python at gmail.com> wrote:
> I'm still very uneasy about how slicing is usually random access, and
> doesn't change how it indexes its elements from repeated use. It means that
> you have something very different for the same syntax.

>>> range(10, 100)[25:35]
range(35, 45)

It's a slice. Whether it's random access or not is pretty much
unrelated to slicing; you get a slice of the underlying object,
whatever that is. A slice of a sliceable iterator should be a sliced
iterator.

ChrisA


More information about the Python-ideas mailing list