[原文] P109
Python uses what are called namespaces to keep track of variables. A namespace is just like a dictionary where the keys are names of variables and the dictionary values are the values of those variables. In fact, you can access a namespace as a Python dictionary, as you'll see in a minute.
[pope译]
Python 使用namespaces 来跟踪变量。命名空间类似于字典,主键是变量的名称,字典中的值是这些变量的值。实际上,你马上就可以看到Python字典一样的命名空间存取 。
[net 译 来源:http://woodpecker.org.cn/diveintopython/html_processing/locals_and_globals.html]
Python 使用叫做名字空间的东西来记录变量的轨迹。名字空间只是一个 dictionary ,它的键字就是变量名,它的值就是那些变量的值。实际上,名字空间可以像 Python的 dictionary 一样进行访问,一会儿我们就会看到。
[popexizhi
is a just like
[pope译]类似于
[net 译]只是
[popexizhi]这里不是类比吗?看net的翻译 感觉 namespace的存储就是dictionary类型了。这个还待确定。如果真是如此那,我的python的namespace的定义就修改一下吧!
]
[原文]P109
At any particular point in a Python program, there are several namespaces available. Each function has its own namespace, called the local namespace, which keeps track of the function's variables, including function arguments and locally defined variables. Each module has its own namespace, called the global namespace, which keeps track of the module's variables, including functions, classes, any other imported modules, and module−level variables and constants. And there is the built−in namespace, accessible from any module, which holds built−in functions and exceptions.
--------------------------------------------------
[pope改进译]
Python程序中每个具体的位置,都包含一些可用的命名空间。每一个函数都有它自己的命名空间,叫做本地命名空间,用来跟踪函数的变量,包含函数的参数和定义的局部变量。每个模块都有自己的命名空间,叫做全局命名空间,用来跟踪模块的变量,包含函数,类,任何其他的导入模块,和模块级别的变量和常量。.并且这里有内嵌的命名空间,可以被任何模块存取,它记录跟踪着内嵌的函数和程序异常。
------------------------------------------------------------------
[pope译]
作为任何一个Python 程序的特点,就是拥有可用的一些命名空间。每一个函数都有它自己的命名空间,叫做本地命名空间,用来跟踪函数的变量,包含函数的参数和定义的局部变量。每个模块都有自己的命名空间,叫做全局命名空间,用来跟踪模块的变量,包含函数,类,任何其他的导入模块,和模块级别的变量和[?]onstants.并且这里有内嵌的命名空间,可以存储任何模块,用来控制内嵌的函数和程序。
[net 译 来源:http://woodpecker.org.cn/diveintopython/html_processing/locals_and_globals.html ]
在一个 Python 程序中的任何一个地方,都存在几个可用的名字空间。每个函数都有着自已的名字空间,叫做局部名字空间,它记录了函数的变量,包括函数的参数和局部定义的变量。每个模块拥有它自已的名字空间,叫做全局名字空间,它记录了模块的变量,包括函数、类、其它导入的模块、模块级的变量和常量。还有就是内置名字空间,任何模块均可访问它,它存放着内置的函数和异常。
[popexizhi
At any particular point in a Python program,there are several namespaces available.
[pope译]作为任何一个Python 程序的特点,就是拥有可用的一些命名空间。
[net 译]在一个 Python 程序中的任何一个地方,都存在几个可用的名字空间。
[popexizhi] at any particular point ,在任何一个具体的位置,pope翻译时particular 理解成 特殊的特点了:),这个是非有点儿远。这个位置ok了,就可以明白说什么了,pope之前的翻译让自己一头雾水啊:)
[?]onstants
[popexizhi] 应该是constants 常量
accessible from any module, which holds built−in functions and exceptions.
[pope译]可以存储任何模块,用来控制内嵌的函数和程序。
[net 译]任何模块均可访问它,它存放着内置的函数和异常。
[popexizhi] accessible from any module ,说的是对built−in 的命名空间可以被任何的模块存取,这个ok。问题是是holds built-in fuctions 和 exception的是built-in 命名空间,这个holds是控制吗?类比上下文,这里应该是“跟踪或是记录”是不是更好一点儿?!
]
没有评论:
发表评论