summaryrefslogtreecommitdiff
path: root/Lib/compiler/ast.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2010-01-09 23:35:54 +0000
committerAlexandre Vassalotti <alexandre@peadrop.com>2010-01-09 23:35:54 +0000
commitee936a21308679654b2d458166ff094ed735fef7 (patch)
tree612cd109e8ede4080f58f30ece3212d8e0f996d2 /Lib/compiler/ast.py
parente36561352895170f28f77f0b4ec4292e35d1cc01 (diff)
downloadcpython-git-ee936a21308679654b2d458166ff094ed735fef7.tar.gz
Issue #2335: Backport set literals syntax from Python 3.x.
Diffstat (limited to 'Lib/compiler/ast.py')
-rw-r--r--Lib/compiler/ast.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/compiler/ast.py b/Lib/compiler/ast.py
index f92307759e..f47434c676 100644
--- a/Lib/compiler/ast.py
+++ b/Lib/compiler/ast.py
@@ -1107,6 +1107,22 @@ class RightShift(Node):
def __repr__(self):
return "RightShift((%s, %s))" % (repr(self.left), repr(self.right))
+class Set(Node):
+ def __init__(self, nodes, lineno=None):
+ self.nodes = nodes
+ self.lineno = lineno
+
+ def getChildren(self):
+ return tuple(flatten(self.nodes))
+
+ def getChildNodes(self):
+ nodelist = []
+ nodelist.extend(flatten_nodes(self.nodes))
+ return tuple(nodelist)
+
+ def __repr__(self):
+ return "Set(%s)" % (repr(self.nodes),)
+
class Slice(Node):
def __init__(self, expr, flags, lower, upper, lineno=None):
self.expr = expr