This reference manual describes the Python programming language. It is not intended as a tutorial.
这个手册描述了Python程序设计语言, 本文档的目的不是入门.
While I am trying to be as precise as possible, I chose to use English rather than formal specifications for everything except syntax and lexical analysis. This should make the document more understandable to the average reader, but will leave room for ambiguities. Consequently, if you were coming from Mars and tried to re-implement Python from this document alone, you might have to guess things and in fact you would probably end up implementing quite a different language. On the other hand, if you are using Python and wonder what the precise rules about a particular area of the language are, you should definitely be able to find them here. If you would like to see a more formal definition of the language, maybe you could volunteer your time -- or invent a cloning machine :-).
虽然我试图尽可能的精确, 但还是选择了英语而不是形式化规范的方法描述, 其中句法分析和词法分析部分除外. 这使的文档更具可读性, 但却有可能存在歧义. 因此, 如果你来自火星并且想单单通过这篇文档就重新实现Python, 你可能得猜测一些东西.事实上你很可能以实现一门完全不同的语言而告终; 另一方面, 如果你在使用Python并且想了解其某个细节的精确规则, 你可以在这里明确地得到它; 如果你想获得更多的语言形式化定义, 可能就要自己搞了-- 或者发明一个克隆机:-).
It is dangerous to add too many implementation details to a language reference document -- the implementation may change, and other implementations of the same language may work differently. On the other hand, there is currently only one Python implementation in widespread use (although a second one now exists!), and its particular quirks are sometimes worth being mentioned, especially where the implementation imposes additional limitations. Therefore, you'll find short ``implementation notes'' sprinkled throughout the text.
在语言参考文档中加入过多的实现细节是危险的事情--实现会改变, 并且一个语言不同的实现可能以不同的方式工作. 另一方面, 当前只有一个Python的实现得到广泛使用(虽然已经存在了第二个实现). 这里有些细节还是被提及了, 特别是某种实现增加了限制时, 因此你可以在本文档中找到"实现注意"的标记.
Every Python implementation comes with a number of built-in and standard modules. These are not documented here, but in the separate Python Library Reference document. A few built-in modules are mentioned when they interact in a significant way with the language definition.
每个Python实现都提供了大量的内建和标准模块, 它们不在这个文档的介绍范围之内, 但可以在另一个叫做Python 库参考手册 的文档中找到. 少量与语言定义密切相关的内建模块也在这被介绍了.