
On Sat, 21 Oct 2023 at 21:57, Ram Rachum <ram@rachum.com> wrote:
It's a little similar to the reasoning behind PEP 618 (adding the `strict` argument to `zip`).
Not quite, since without strict, zip will truncate - it doesn't have a different return value.
A keyword argument is easier to add, and makes the code less ugly, then an `if` clause. When I don't have that `if` clause you mentioned in my code, it's not because I forgot, it's because I don't want an extra clause for something I don't think is going to happen. Also, a keyword argument enables code linters to enforce a rule that the `require` argument must always be specified. (Example.)
What about an if with the match inside it? if m := re.match(...): ... That's one of the motivating examples behind the walrus after all. ChrisA