summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-05-19 08:20:33 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-05-19 08:20:33 (GMT)
commit354433a59dd1701985ec8463ced25a967cade3c1 (patch)
tree9e342cc53199814f81b25daabcdb85da1851bd50 /Tools
parent285cfccecba911531b37b8a7dde45bf07d3cf9b0 (diff)
downloadcpython-354433a59dd1701985ec8463ced25a967cade3c1.zip
cpython-354433a59dd1701985ec8463ced25a967cade3c1.tar.gz
cpython-354433a59dd1701985ec8463ced25a967cade3c1.tar.bz2
SF patch #872326: Generator expression implementation
(Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/compiler/ast.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/Tools/compiler/ast.txt b/Tools/compiler/ast.txt
index 3f8953b..6a990d4 100644
--- a/Tools/compiler/ast.txt
+++ b/Tools/compiler/ast.txt
@@ -38,6 +38,10 @@ AssAttr: expr, attrname*, flags*
ListComp: expr, quals!
ListCompFor: assign, list, ifs!
ListCompIf: test
+GenExpr: code
+GenExprInner: expr, quals!
+GenExprFor: assign, iter, ifs!
+GenExprIf: test
List: nodes!
Dict: items!
Not: expr
@@ -85,3 +89,10 @@ init(Lambda):
self.varargs = 1
if flags & CO_VARKEYWORDS:
self.kwargs = 1
+
+init(GenExpr):
+ self.argnames = ['[outmost-iterable]']
+ self.varargs = self.kwargs = None
+
+init(GenExprFor):
+ self.is_outmost = False