Re: PEP 622 version 2 (Structural Pattern Matching)

July 12, 2020
6:29 p.m.
Greg Ewing wrote:
Eric Nieuwland wrote:
... match poly: p0 = Point(x0, y0) p1 = Point(x1, y1) p2 = Point(x2, y2) case Polygon(p0, p1, p2): …
Interesting idea, but what happens if you don't need any setup? Do you have to write
match poly: pass case ...
?
Yes, that would be the idea. Unless you would need to setup variables to be bound in the cases, of course. Without that an if … elif … elif … else structure would be equivalent and possibly preferable.
1688
Age (days ago)
1688
Last active (days ago)
0 comments
1 participants
participants (1)
-
Eric Nieuwland