> > On Tue, 17 Nov 2020 at 10:35, Nuri Jung <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/UXMQOHBLDHKFHS4D5P5CVR6DPGV5XYAY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to