Two related proposals. 1. Add a warning similar to the one for the dis module. As modified: "CPython implementation detail: The ast definition is specific to the CPython interpreter! Ast nodes may be added, removed, or changed between versions. Use *ast.__version__* to work across versions." I omitted " Use of this module should not be considered to work across Python VMs or Python releases." as redundant and too legalistic. *ast.__version__* should link to its (new) entry). 2. Add a full entry for __version__. Currently (3.2): "The module defines a string constant __version__ which is the decimal Subversion revision number of the file shown below." Proposed replacement (with hidden reference point): ast.__version__ [__version__ in normal entry boldface] String constant with version number of abstract grammar file. 3.1: 67616; 3.2: 82163; 3.3: xxxxxxxxx
Sounds good to me, except for "Use *ast.__version__* to work across versions." which is not quite clear. While talking about version numbers, we should probably also document *what changed* between those versions.
The Python Insider blog has a nice phrasing: “The AST module exposes a constant, ``ast.__version__``, which provides a means for user code to vary its behaviour depending on the version of the AST it encounters.”
> 1. Add a warning similar to the one for the dis module. The current documentation says: "The abstract syntax itself might change with each Python release; [...]" https://docs.python.org/3.4/library/ast.html > 2. Add a full entry for __version__. Currently (3.2): ast.__version__ has been removed in issue 12273. Closing this as "out of date".
History
Date
User
Action
Args
2022-04-11 14:57:15
admin
set
github: 55971
2014-06-30 08:51:12
berker.peksag
set
status: open -> closednosy: + berker.peksagmessages: + resolution: out of datestage: needs patch -> resolved