关于python:范围意味着什么

What does scope mean

本问题已经有最佳答案,请猛点这里访问。

从python参考手册:

A scope defines the visibility of a name within a block. If a local
variable is defined in a block, its scope includes that block.

When a name is used in a code block, it is resolved using the nearest
enclosing scope.

所以很明显,这不是引用范围的意思。作用域是绑定name-->value的集合是真的吗?那么,enclosing scope是什么意思呢?这是否意味着每个范围都必须包含对enclosing scope的引用?


@Martjin Pieters Clarifications and Answers are awesome,but I like to a d d that beyond Python,scope is a computer science/programming concept that spans across basically all programming languages currently in use.

要学会更多关于什么是,将军,从Python,我在这里开始:http://en.wikipedia.org/wiki/scope (计算机科学)

许多语言,包括Python,遵循同样的基本规章,但细节在语言上可能有所不同。Thus,如果你真的问"Scope是什么?"从一个一般的来源开始,可能比学会Python的内在特征更为有用(至少在第一个来源)。