homepage

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.

Author eryksun
Recipients docs@python, eryksun, leewz
Date 2016年05月25日.08:13:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464163981.13.0.194675480737.issue27119@psf.upfronthosting.co.za>
In-reply-to
Content
What you're looking for is in the 2nd paragraph of the ast docs:
 An abstract syntax tree can be generated by passing
 ast.PyCF_ONLY_AST as a flag to the compile() built-in
 function, or using the parse() helper provided in this
 module. The result will be a tree of objects whose
 classes all inherit from ast.AST. An abstract syntax
 tree can be compiled into a Python code object using
 the built-in compile() function.
For example:
 >>> mod = compile('42', '', 'exec', ast.PyCF_ONLY_AST)
 >>> mod
 <_ast.Module object at 0x7f0e45b15be0
 >>> ast.dump(mod)
 'Module(body=[Expr(value=Num(n=42))])'
In the discussion of `flags`, I think the compile docs should explicitly list ast.PyCF_ONLY_AST and the CO_FUTURE_* flags in a table.
History
Date User Action Args
2016年05月25日 08:13:01eryksunsetrecipients: + eryksun, docs@python, leewz
2016年05月25日 08:13:01eryksunsetmessageid: <1464163981.13.0.194675480737.issue27119@psf.upfronthosting.co.za>
2016年05月25日 08:13:01eryksunlinkissue27119 messages
2016年05月25日 08:13:00eryksuncreate

AltStyle によって変換されたページ (->オリジナル) /