9 Dec
2019
9 Dec
'19
1 a.m.
On 8 Dec 2019, at 20:11, Guido van Rossum
wrote:
On Sun, Dec 8, 2019 at 11:03 AM Anders Hovmöller
wrote: On 8 Dec 2019, at 19:40, Guido van Rossum
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.
Ah. Sorry. My bad.