How is `x = 42; x = lambda: x` parsed?

后端 未结 0 1431
粉色の甜心
粉色の甜心 2020-12-04 15:02

I was surprised that this assertion fails:

x = 42
x = lambda: x
assert x() == 42

The actual result is that x recursively refers

相关标签:
回答
  • 消灭零回复
提交回复
热议问题