【发布时间】:2021-05-04 09:44:45
【问题描述】:
我无法运行此代码:
match shape:
case Point(x, y):
...
case Rectangle(x, y, _, _):
...
print(x, y)
我在 Python 中找不到 match 关键字。
我在这里找到它:https://www.python.org/dev/peps/pep-0622/#the-match-statement
有什么想法吗?
【问题讨论】:
-
"Status: Superseded" 表示链接,也给出了参考实现。
-
但是.....这里的问题是什么?
标签: python functional-programming python-3.10 structural-pattern-matching