➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: ast module docs document private attribute
类型: behavior Stage:
Components: None, Documentation Versions: Python 3.0, Python 2.6
process
状态: closed Resolution: wont fix
Dependencies: 后续:
分配给: georg.brandl 抄送列表: brett.cannon, georg.brandl, loewis, rhettinger
优先级: critical 关键字: 26backport, easy

Created on 2008-06-20 20:36 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg68473 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) 日期: 2008-06-20 20:36
The docs for the ast module document the '_fields' attribute on AST
instances. Either that documentation needs to go away or the attribute
needs to be renamed as the leading underscore means it is private to the
internal API.
msg68474 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) 日期: 2008-06-20 20:41
I disagree. The AST classes are auto-generated, the leading underscore
of _fields is there to avoid clashes with field names from the AST types.

This is similar to
http://docs.python.org/dev/library/collections#collections.somenamedtuple._fields
which shouldn't be renamed, but isn't private either.
msg68476 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) 日期: 2008-06-20 21:04
This is consistent with the methods in named tuples (also to avoid name 
clashes).
msg68480 - (view) Author: Martin v. Löwis (loewis) * (Python committer) 日期: 2008-06-20 21:59
I agree with Georg and Raymond, closing this as "won't fix".
历史
日期 用户 动作 参数
2022-04-11 14:56:35admin修改github: 47402
2008-06-20 21:59:49loewis修改状态: open -> closed
抄送: + loewis
resolution: wont fix
消息: + msg68480
2008-06-20 21:04:27rhettinger修改keywords: + 26backport
抄送: + rhettinger
消息: + msg68476
components: + None
2008-06-20 20:41:32georg.brandl修改消息: + msg68474
2008-06-20 20:36:33brett.cannon创建