On Sat, 21 Oct 2023 at 21:57, Ram Rachum <r...@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
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EDPVFGDI53HULMSYZUDFZSXTHRD4GAG4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to