31 Oct
2020
31 Oct
'20
8:01 a.m.
On Sat, 31 Oct 2020 at 17:49, Paul Sokolovsky
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 | ncoghlan@gmail.com | Brisbane, Australia