"Structural pattern matching" for Python, part 2
"Structural pattern matching" for Python, part 2
Posted Sep 4, 2020 11:31 UTC (Fri) by gray_-_wolf (subscriber, #131074)Parent article: "Structural pattern matching" for Python, part 2
I would have assume that
match p:
case (x, x):
would match points where p.x == p.y. However that does not seem to be the case. How can I express such a match?
Second question, if constants must be namespaced, is there no way to express something like:
x = 1
match p:
case (x, y):
For points that are `(1, .*)`? Is there something like `local` namespaces for local variables in python?
I'm not a python programmer, so I might be lacking some parts of the proper mindset, but it seems... limiting.
