> On 8 Dec 2019, at 19:40, Guido van Rossum <[email protected]> wrote: > > > We're not changing next(). It's too fundamental to change even subtly. > > We might add itertools.first(), but not builtins.first(). This kind of > functionality is not fundamental but it's easy to get slightly wrong (witness > many hasty attempts in these threads). > > itertools.first() should be implemented in C, but its semantics should be > given by this (well, let me see if I can get it right): > > def first(it, /, default=None): > it = iter(it) > try: > return next(it) > except StopIteration: > return default
Why ban the use of keyword argument for the default value? _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/GHYWWEO2UHNXAE5ZVW4EYGFEJXW7AXAX/ Code of Conduct: http://python.org/psf/codeofconduct/
