内置名称空间有存活少量常量。它们是:
The sole value of types.NoneType . None is frequently used to represent the absence of a value, as when default arguments are not passed to a function.
2.4 版改变: 赋值 None 是非法的且会引发 SyntaxError .
Special value which can be returned by the “rich comparison” special methods ( __eq__() , __lt__() , and friends), to indicate that the comparison is not implemented with respect to the other type.
Special value used in conjunction with extended slicing syntax.
注意
名称 None and __debug__ 无法重新赋值 (赋值它们,即使作为属性名称,引发 SyntaxError ),所以它们可以被认为是真常量。
2.7 版改变: 赋值 __debug__ as an attribute became illegal.
The site 模块 (在启动期间被自动导入,除了若 -S 命令行选项有给定) 将几个常量添加到内置名称空间。它们很有用对于交互解释器 Shell,且不应用于程序中。
对象当打印时,打印消息像 "Use quit() or Ctrl-D (i.e. EOF) to exit",和当调用时,引发 SystemExit 采用指定退出代码。