2.4 可变数据 #109
Replies: 13 comments 6 replies
-
约束传递实现看的一头雾水😥 |
Beta Was this translation helpful? Give feedback.
-
2.4.4 局部状态 中的 “以下运行环境图展示了多次调用由 make_withdraw 创建的函数的效果”不是对应的make_withdraw代码 |
Beta Was this translation helpful? Give feedback.
-
约束传递这部分我理解应该是 将整个计算过程,拆解成许多子模块。 |
Beta Was this translation helpful? Give feedback.
-
在2.4.4最后一段第一句话这样用中文表达是不是更加合理,“当你在函数内部给一个变量赋值时,Python 会将这个变量视为局部变量。如果在赋值之前尝试引用这个变量,并且它在当前帧中还没有被定义,Python 会抛出一个 UnboundLocalError 异常。” |
Beta Was this translation helpful? Give feedback.
-
凌晨三点给我头都看大了 😢 |
Beta Was this translation helpful? Give feedback.
-
看得确实头大... |
Beta Was this translation helpful? Give feedback.
-
虽然很抽象,但是内容很好啊 |
Beta Was this translation helpful? Give feedback.
-
这一章的内容虽然有点难啃,但是关于变量的查值顺序(scope)等真的帮助很大🥲(让我们感谢ChatGPT) 不过一次看完真的有点头大。。。分两部分看吧,实现的感觉可以放在第二部分再看! |
Beta Was this translation helpful? Give feedback.
-
疑问: >>> def outer():
x = "outer-x"
def middle():
x = "middle-x"
def inner():
nonlocal x
x = "inner-x"
inner()
print("middle:", x)
middle()
print("outer:", x)
outer()
#输出
middle: inner-x
outer: outer-x 如果是这种情况,相应的变化并不是更新到x第一次被声明的地方,更严谨的说法应该是改变的是最近的,非全局的那个作用域中存在的相应变量 |
Beta Was this translation helpful? Give feedback.
-
简单的总结,约束器与连接器的主要作用是进行非线性的运算,在已知等式关系的情况下,给定某一值进行运算,求解等式关系的其他值。 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
2.4 可变数据
SICP Python 中文翻译
https://composingprograms.netlify.app/2/4
Beta Was this translation helpful? Give feedback.
All reactions