Issue #2335: Backport set literals syntax from Python 3.x.
diff --git a/Lib/compiler/ast.py b/Lib/compiler/ast.py
index f923077..f47434c 100644
--- a/Lib/compiler/ast.py
+++ b/Lib/compiler/ast.py
@@ -1107,6 +1107,22 @@
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