Identifiers (also referred to as names) are described by the following lexical definitions:
标识符(也叫做名字)由以下词法定义描述:
identifier |
::= | (letter|"_")
(letter
|
digit | "_")* |
letter |
::= |
lowercase |
uppercase |
lowercase |
::= | "a"..."z" |
uppercase |
::= | "A"..."Z" |
digit |
::= | "0"..."9" |
Identifiers are unlimited in length. Case is significant.
标识符不限长, 区分大小写.
The following identifiers are used as reserved words, or keywords of the language, and cannot be used as ordinary identifiers. They must be spelled exactly as written here:
以下标识符用作保留字, 或者叫做语言的关键字, 并且不能作为普通标识符使用, 而且它们必须像下面的那样严格拼写.
and del for is raise assert elif from lambda return break else global not try class except if or while continue exec import pass yield def finally in print
Note that although the identifier as can be used as
part of the syntax of import statements,
it is not currently a reserved word.
In some future version of Python, the identifiers
as and None will both become
keywords.
Certain classes of identifiers (besides keywords) have special meanings. These classes are identified by the patterns of leading and trailing underscore characters:
(关键字以外的)某些类型的标识符具有特殊的含义, 如下:
_*不能通过" from moduls import *"导入。 特定标识符"_"在交互式解释器用于存储上次估值的结果. 它位于__buildin__模块之中. 在非交互方式时,"_"没有特殊含义, 且是未定义的
Note: The name "_" is often used in conjunction with internationalization; refer to the documentation for the gettext module for more information on this convention.
__*__系统定义的名字
__*类私有名字