|
1 | 1 | """ |
2 | | - ast |
3 | | - ~~~ |
4 | | -
|
5 | | - The `ast` module helps Python applications to process trees of the Python |
6 | | - abstract syntax grammar. The abstract syntax itself might change with |
7 | | - each Python release; this module helps to find out programmatically what |
8 | | - the current grammar looks like and allows modifications of it. |
9 | | -
|
10 | | - An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as |
11 | | - a flag to the `compile()` builtin function or by using the `parse()` |
12 | | - function from this module. The result will be a tree of objects whose |
13 | | - classes all inherit from `ast.AST`. |
14 | | -
|
15 | | - A modified abstract syntax tree can be compiled into a Python code object |
16 | | - using the built-in `compile()` function. |
17 | | -
|
18 | | - Additionally various helper functions are provided that make working with |
19 | | - the trees simpler. The main intention of the helper functions and this |
20 | | - module in general is to provide an easy to use interface for libraries |
21 | | - that work tightly with the python syntax (template engines for example). |
22 | | -
|
23 | | -
|
24 | | - :copyright: Copyright 2008 by Armin Ronacher. |
25 | | - :license: Python License. |
| 2 | +The `ast` module helps Python applications to process trees of the Python |
| 3 | +abstract syntax grammar. The abstract syntax itself might change with |
| 4 | +each Python release; this module helps to find out programmatically what |
| 5 | +the current grammar looks like and allows modifications of it. |
| 6 | +
|
| 7 | +An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as |
| 8 | +a flag to the `compile()` builtin function or by using the `parse()` |
| 9 | +function from this module. The result will be a tree of objects whose |
| 10 | +classes all inherit from `ast.AST`. |
| 11 | +
|
| 12 | +A modified abstract syntax tree can be compiled into a Python code object |
| 13 | +using the built-in `compile()` function. |
| 14 | +
|
| 15 | +Additionally various helper functions are provided that make working with |
| 16 | +the trees simpler. The main intention of the helper functions and this |
| 17 | +module in general is to provide an easy to use interface for libraries |
| 18 | +that work tightly with the python syntax (template engines for example). |
| 19 | +
|
| 20 | +:copyright: Copyright 2008 by Armin Ronacher. |
| 21 | +:license: Python License. |
26 | 22 | """ |
27 | 23 | import sys |
28 | 24 | import re |
|
0 commit comments