On Sun, 22 Oct 2023 at 06:11, Ram Rachum <[email protected]> wrote:
>
> 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.
>

Oh, you mean like AttributeError?

ChrisA
_______________________________________________
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/CAG7AI2MKNSB6RTGHBYLQSD6MAOQO3AN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to