mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Hide list comp variables and support set comprehensions
This commit is contained in:
parent
6ef6306dd6
commit
650f0d06d3
29 changed files with 2006 additions and 1323 deletions
|
@ -559,7 +559,7 @@ class Transformer:
|
|||
testlist1 = testlist
|
||||
exprlist = testlist
|
||||
|
||||
def testlist_gexp(self, nodelist):
|
||||
def testlist_comp(self, nodelist):
|
||||
if len(nodelist) == 2 and nodelist[1][0] == symbol.gen_for:
|
||||
test = self.com_node(nodelist[0])
|
||||
return self.com_generator_expression(test, nodelist[1])
|
||||
|
@ -1027,7 +1027,7 @@ class Transformer:
|
|||
# loop to avoid trivial recursion
|
||||
while 1:
|
||||
t = node[0]
|
||||
if t in (symbol.exprlist, symbol.testlist, symbol.testlist_safe, symbol.testlist_gexp):
|
||||
if t in (symbol.exprlist, symbol.testlist, symbol.testlist_comp):
|
||||
if len(node) > 2:
|
||||
return self.com_assign_tuple(node, assigning)
|
||||
node = node[1]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue