
Dec. 8, 2019
7:10 p.m.
On Sun, Dec 8, 2019 at 11:03 AM Anders Hovmöller <boxed@killingar.net> wrote:
On 8 Dec 2019, at 19:40, Guido van Rossum <guido@python.org> wrote:
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?
You must misremember PEP 570. This use of `/` means that `it` must be passed positional (it's mandatory and it's the "main" argument), but that `default` can be specified positionally or via a keyword. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>