Python - 命名空间和作用域

参考

  1. https://blog.csdn.net/sakurainluojia/article/details/72783752
  2. https://docs.python.org/3.6/tutorial/classes.html

概念

A scope is a textual region of a Python program where a namespace is directly accessible. “Directly accessible” here means that an unqualified reference to a name attempts to find the name in the namespace.

即可以在静态的作用域(本质是一段文本)中访问动态的命名空间(解释器启动时创建)

猜你喜欢

转载自www.cnblogs.com/allen2333/p/9072899.html