python - 为什么文档在定义 "directly"时使用单词 "scope"?

标签 python scope reference namespaces

来自 docs :

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.


为什么文档在定义“范围”时使用“直接”一词?它有什么意义吗?如果将“范围”定义为可访问命名空间的 Python 程序的文本区域,是否会有所不同?

最佳答案

始终可以通过限定引用来访问 namespace 。如果引用不需要限定,则可直接访问。

关于python - 为什么文档在定义 "directly"时使用单词 "scope"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66292544/

相关文章:

python - 通过 Pandas DataFrame 搜索子字符串的最有效方法是什么?

python - 传递 kwarg 失败于 2.7

python - selenium webriverwait 引发错误但没有描述

javascript - jQuery TimeCircles 事件监听器范围

java - 调用在另一个类中创建的对象的方法

python - 使用discord.py获取 channel 的名称

c - 一旦超出范围,C 是否会重用本地 block var 的内存?

c++ - 从公共(public)派生类访问 protected 成员

c++ - 是否可以更改临时对象并将其作为参数传递?

c++ - 该函数尝试引用已删除的函数,但该函数已设置为删除