11.12.19 10:45, Steven D'Aprano пише:
The thing is, we're fooled by the close similarity of iteration over
iterators and other iterables (sequences and containers). Destructive
iteration and non-destructive iteration is a big difference. Utility
functions like the proposed `first` that try to pretend there is no such
difference are, I believe, a gotcha waiting to happen.

This is a good argument against first(). I was only -0 before, but now I am closer to strong -1.

To use first() correctly you should know that it is barely a combination of iter() and next(), and if you know this, you no longer need first(). Using first() without knowing this is errorprone.
_______________________________________________
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/AER3TMOVQZBFOZFJAX5BFYU7CCZXCEAZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to