
On Fri, 13 Dec 2019 at 22:47, Tim Peters <tim.peters@gmail.com> wrote:
[Christopher Barker]
I think we all agree that it does not belong in __builtins__,
[Greg Ewing]
Do we?
Nobody yet has argued in favor of it - or even suggested it.
I'm not convinced.
And that remains true even now ;-) The new part here is that yours is the first message to mention it that did _not_ say outright that first() does not belong in the builtins.
We already have all() and any() in builtins, which are similar in that they operate on iterators or iterables.
Also things like map() and zip(), but things like that predate itertools. My view is that first() just isn't likely to be used often enough to merit making it a builtin. all() and any() are. If we had it to do over, I bet zip() would have been assigned to itertools. map() is too close to call, although these days, in new code, I usually see a list comprehension where I used to see map().
I think that first could get wider usage than next. Outside of implementing abstract iterator tools my experience is that the bulk of situations in which next is used/suggested would be better handled by (the raising version of) first. -- Oscar