Hi folks, moderator here. No need to respond.
thanks, --titus On Fri, Dec 27, 2019 at 03:37:14PM -0000, Marco Sulla via Python-ideas wrote: > Eric Fahlgren wrote: > > You apparently did not read the posts, because the point was whether it > > raises or returns a default value, not whether it saves one line or ten. > > You apparently don't know Python: > > ``` > next(iterator) # raises an exception if no more elements > next(iterator, _sentinel) # returns _sentinel if no more elements > ``` > > So, what's the advantage of having `first()`? Furthermore, **how can you be > sure this is the __real first element__ of the iterable, if you pass an > iterator?** > > The disadvantage is that you hide the iterator, that could be useful later in > the code. > > KISSes. > _______________________________________________ > 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/VJMO4HOZGFCAKY2WA2RACHITPECFDKQ7/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- C. Titus Brown, ctbr...@ucdavis.edu _______________________________________________ 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/KV4K4KS4MYTP5T5W5XKZYENGHCJYWOFR/ Code of Conduct: http://python.org/psf/codeofconduct/