> > On Tue, 17 Nov 2020 at 10:35, Nuri Jung <jnoo...@snu.ac.kr> wrote:
> >>
> >> How about enabling subscription operator (`[]`) for generator expressions? 
> >> Also for all `zip()`, `key()`, etc. They could be evaluated in the 
> >> background only for the requested amount, to avoid evaluating the whole 
> >> expression to something like a list or tuple, then indexed.
>
> On Tue, 17 Nov 2020 at 15:37, Joao S. O. Bueno <jsbu...@python.org.br> wrote:
> >
> > Although that is not a pattern I recall I had needed, but for the first 
> > item in a generator,
> > I recognize it is more complicated than it should to be able to do that.
> >
On Tue, 17 Nov 2020 at 15:57, Paul Moore <p.f.mo...@gmail.com> wrote:
>
> >>> from itertools import islice
> >>> a = (i for i in range(0, 100, 10))
> >>> next(islice(a, 5, None))

It would be nice if islice gave an object that supported slicing so
that you could spell it like:

   for x in islice(a)[5:]:

I find it hard to decipher the meaning of the arguments to islice
compared to reading a normal slice expression.

--
Oscar
_______________________________________________
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/UXMQOHBLDHKFHS4D5P5CVR6DPGV5XYAY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to