On Sun, 22 Oct 2023 at 06:11, Ram Rachum <r...@rachum.com> wrote:
>
> On Sat, Oct 21, 2023 at 10:01 PM Chris Angelico <ros...@gmail.com> wrote:
>>
>> On Sat, 21 Oct 2023 at 21:57, Ram Rachum <r...@rachum.com> 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 -- 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/CAG7AI2MKNSB6RTGHBYLQSD6MAOQO3AN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to