On Sat, 31 Oct 2020 at 17:49, Paul Sokolovsky <[email protected]> wrote:
> Alternatively, can add "inline guard sigils" for the most common guard
> conditions, which would be equality, period:
>
> match r:
> case (src, None):
> case (==c, msg):
> case (==s, msg):
`==` interacts poorly with other aspects of the pattern syntax (most
notably keywords in class patterns), but PEP 642's identity constraint
expressions would allow:
match r:
case (src, ?is None):
... # Any src, msg is None
case (?is c, msg):
... # Any msg, src is c
case (?is s, msg):
... # Any msg, src is s
Cheers,
Nick.
--
Nick Coghlan | [email protected] | Brisbane, Australia
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/MVJY42LZM7ITRMZ3TSHC23GOMKIS6FCJ/
Code of Conduct: http://python.org/psf/codeofconduct/