diff options
Diffstat (limited to 'Doc/lib/compiler.tex')
-rw-r--r-- | Doc/lib/compiler.tex | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Doc/lib/compiler.tex b/Doc/lib/compiler.tex index d75dad7eae..79f03354bf 100644 --- a/Doc/lib/compiler.tex +++ b/Doc/lib/compiler.tex @@ -269,21 +269,24 @@ the class names from the \module{compiler.ast} module. >>> mod = compiler.parseFile("/tmp/doublelib.py") >>> mod Module('This is an example module.\n\nThis is the docstring.\n', - Stmt([Function('double', ['x'], [], 0, 'Return twice the argument', - Stmt([Return(Mul((Name('x'), Const(2))))]))])) + Stmt([Function(None, 'double', ['x'], [], 0, + 'Return twice the argument', + Stmt([Return(Mul((Name('x'), Const(2))))]))])) >>> from compiler.ast import * >>> Module('This is an example module.\n\nThis is the docstring.\n', -... Stmt([Function('double', ['x'], [], 0, 'Return twice the argument', -... Stmt([Return(Mul((Name('x'), Const(2))))]))])) +... Stmt([Function(None, 'double', ['x'], [], 0, +... 'Return twice the argument', +... Stmt([Return(Mul((Name('x'), Const(2))))]))])) Module('This is an example module.\n\nThis is the docstring.\n', - Stmt([Function('double', ['x'], [], 0, 'Return twice the argument', - Stmt([Return(Mul((Name('x'), Const(2))))]))])) + Stmt([Function(None, 'double', ['x'], [], 0, + 'Return twice the argument', + Stmt([Return(Mul((Name('x'), Const(2))))]))])) >>> mod.doc 'This is an example module.\n\nThis is the docstring.\n' >>> for node in mod.node.nodes: ... print node ... -Function('double', ['x'], [], 0, 'Return twice the argument', +Function(None, 'double', ['x'], [], 0, 'Return twice the argument', Stmt([Return(Mul((Name('x'), Const(2))))])) >>> func = mod.node.nodes[0] >>> func.code |