]> granicus.if.org Git - python/commitdiff
Updated interactive examples in the "Examples" session to reflect the
authorEdward Loper <edloper@gradient.cis.upenn.edu>
Tue, 28 Sep 2004 02:53:50 +0000 (02:53 +0000)
committerEdward Loper <edloper@gradient.cis.upenn.edu>
Tue, 28 Sep 2004 02:53:50 +0000 (02:53 +0000)
fact that compiler.ast.Function now takes a "decorators" argument.

Doc/lib/compiler.tex

index d75dad7eae70486d79c0944495d7d58609d25f37..79f03354bf9d8c5a92021f9e9a94c8d5e9da93c4 100644 (file)
@@ -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