...域(Scope)的基本概念和基于具体语言的判定方法就不谈了,不过值得了解的是作用域的两种基本类型:静态作用域(Static Scoping) 和 动态作用域(Dynamic Scoping)。
基于12个网页-相关网页
You might be surprised here if you are unfamiliar with the trick — Python does not have an "official" static scoping declaration.
这里,如果您不熟悉这个诀窍,可能会感到诧异—python没有“正式”的静态范围声明。
Notice too that the Listing 2 version could consist entirely of static methods. No Shared knowledge exists between the methods, so I have less need for encapsulation via scoping.
还要注意清单2版本可以完全由静态方法组成,因此就不太需要通过scoping来封装。
应用推荐