On Sat, Oct 21, 2023 at 10:01 PM Chris Angelico <[email protected]> wrote:
> On Sat, 21 Oct 2023 at 21:57, Ram Rachum <[email protected]> wrote: > > 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. > I love that, but it mostly makes sense for "if there's a match do this, otherwise do that" where most cases fall into "I'm absolutely sure there's a match here and here's what we should do with that match", and when that "absolutely sure" fails, the proper way to deal with that is by raising an exception.
_______________________________________________ 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/UXRGYESPWW2BTCSHRP64HFM2UJS27J6M/ Code of Conduct: http://python.org/psf/codeofconduct/
