Re: PEP 622 version 2 (Structural Pattern Matching)

13 Jul
2020
13 Jul
'20
2:29 a.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.
1238
Age (days ago)
1238
Last active (days ago)
0 comments
1 participants
participants (1)
-
Eric Nieuwland