“Python/docs/3.9/library/symbol”的版本间差异

来自菜鸟教程
Python/docs/3.9/library/symbol
跳转至:导航、​搜索
(autoload)
 
(Page commit)
 
第1行: 第1行:
 +
{{DISPLAYTITLE:符号 — 与 Python 解析树一起使用的常量 — Python 文档}}
 
<div id="module-symbol" class="section">
 
<div id="module-symbol" class="section">
  
 
<span id="symbol-constants-used-with-python-parse-trees"></span>
 
<span id="symbol-constants-used-with-python-parse-trees"></span>
= [[#module-symbol|<code>symbol</code>]] --- Constants used with Python parse trees =
+
= symbol — 与 Python 解析树一起使用的常量 =
  
'''Source code:''' [https://github.com/python/cpython/tree/3.9/Lib/symbol.py Lib/symbol.py]
+
'''源代码:''' [[#id1|<span id="id2" class="problematic">:source:`Lib/symbol.py`</span>]]
  
This module provides constants which represent the numeric values of internal
+
 
nodes of the parse tree. Unlike most Python constants, these use lower-case
+
-----
names. Refer to the file <code>Grammar/Grammar</code> in the Python distribution for
+
 
the definitions of the names in the context of the language grammar. The
+
该模块提供了代表解析树内部节点数值的常量。 与大多数 Python 常量不同,它们使用小写名称。 有关语言语法上下文中名称的定义,请参阅 Python 发行版中的文件 <code>Grammar/Grammar</code>。 名称映射到的特定数值可能会在 Python 版本之间发生变化。
specific numeric values which the names map to may change between Python
 
versions.
 
  
 
<div class="admonition warning">
 
<div class="admonition warning">
第17行: 第16行:
 
警告
 
警告
  
The symbol module is deprecated and will be removed in future versions of
+
不推荐使用符号模块,并将在 Python 的未来版本中删除。
Python.
+
 
 +
 
 +
</div>
 +
该模块还提供了一个额外的数据对象:
 +
 
 +
; <span class="sig-prename descclassname"><span class="pre">symbol.</span></span><span class="sig-name descname"><span class="pre">sym_name</span></span>
 +
: 将此模块中定义的常量的数值映射回名称字符串的字典,允许生成更易读的解析树表示。
  
  
 
</div>
 
</div>
This module also provides one additional data object:
+
<div class="clearer">
  
; <code>symbol.</code><code>sym_name</code>
 
: Dictionary mapping the numeric values of the constants defined in this module back to name strings, allowing more human-readable representation of parse trees to be generated.
 
  
  
 
</div>
 
</div>
  
[[Category:Python 3.9 中文文档]]
+
[[Category:Python 3.9 文档]]

2021年10月31日 (日) 04:53的最新版本

symbol — 与 Python 解析树一起使用的常量

源代码: :source:`Lib/symbol.py`



该模块提供了代表解析树内部节点数值的常量。 与大多数 Python 常量不同,它们使用小写名称。 有关语言语法上下文中名称的定义,请参阅 Python 发行版中的文件 Grammar/Grammar。 名称映射到的特定数值可能会在 Python 版本之间发生变化。

警告

不推荐使用符号模块,并将在 Python 的未来版本中删除。


该模块还提供了一个额外的数据对象:

symbol.sym_name
将此模块中定义的常量的数值映射回名称字符串的字典,允许生成更易读的解析树表示。