On Fri, Dec 13, 2019 at 09:24:20AM +0200, Serhiy Storchaka wrote: > 12.12.19 03:22, Stephen J. Turnbull пише: > >I would prefer that it not be implemented at all, but > >if it is implemented, its behavior should respect the intuition of the > >majority of those who want it, which seems to me to be "a variant of > >next() that doesn't raise and returns None by default on an empty > >iterable." > > This is not what the majority expects and is not how first() from > more-itertools works.
I don't know who this majority is, or how you know they are a majority, but in this thread, the OP Juancarlo's implementation behaved as Stephen suggested; Guido's version behaved as Stephen suggested; my version behaved as Stephen suggested. I don't recall who wants a version of first that raises, or when that would be useful. It would greatly limit it's usefulness in expressions, since it needs to be guarded by a try...except. -- Steven _______________________________________________ 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/2TX3CX3T27N23I46MLXB6LPLP465YX4H/ Code of Conduct: http://python.org/psf/codeofconduct/