Commit d609632a authored by Stefan Behnel's avatar Stefan Behnel

replace frozenset([...]) by frozenset((...))

--HG--
extra : amend_source : 7954c320c39d51cde9ac7d4368258ceb56a3bc2f
parent b8d4929e
......@@ -1598,6 +1598,15 @@ class EarlyReplaceBuiltinCalls(Visitor.EnvTransform):
return ExprNodes.AsTupleNode(node.pos, arg=result)
return node
def _handle_simple_function_frozenset(self, node, pos_args):
"""Replace frozenset([...]) by frozenset((...)) as tuples are more efficient.
"""
if len(pos_args) != 1:
return node
if isinstance(pos_args[0], ExprNodes.ListNode):
pos_args[0] = pos_args[0].as_tuple()
return node
def _handle_simple_function_list(self, node, pos_args):
if not pos_args:
return ExprNodes.ListNode(node.pos, args=[], constant_result=[])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment