On Fri, 19 Mar 2021 at 14:38, Paul Bryan <pbr...@anode.ca> wrote:

> On Fri, 2021-03-19 at 10:22 -0700, Guido van Rossum wrote:
>
> I’m not convinced that we need aiter(x, sentinel) at all — for iter() it’s
> mostly a legacy compatibility API.
>
>
> I'm feel like I'm going to learn something today. To date, the pattern
> I've used for getting the first item from an iterable:
>
> next(iter(i))
>
>
> What's the recommended alternative?
>

I end up doing this most times:

def first(i):
    return next(iter(i))

Seens too simple to request to be in the sdlib, and it is so simple that
would be forgotten if it were
in any 3rd party extension


>
> Paul
>
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/2XNN6NYR6WXKVQN5UDCPVMY7KRDKF3BG/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/PVR3LAKIXS24MC5FAUYNERIBDFI6KJKQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to