in the common case, the and operation isn't needed

This commit is contained in:
Benjamin Peterson 2011-05-19 22:11:18 -05:00
parent dc3e39e95c
commit 265b7458cb
1 changed files with 4 additions and 1 deletions

View File

@ -314,5 +314,8 @@ class AssertionRewriter(ast.NodeVisitor):
ast.Tuple(load_names, ast.Load()),
ast.Tuple(expls, ast.Load()),
ast.Tuple(results, ast.Load()))
res = ast.BoolOp(ast.And(), load_names)
if len(comp.ops) > 1:
res = ast.BoolOp(ast.And(), load_names)
else:
res = load_names[0]
return res, self.explanation_param(self.pop_format_context(expl_call))