Commits

Benjamin Peterson committed 91f0d27

use generator expressions in any()

  • Participants
  • Parent commits 22038ab

Comments (0)

Files changed (3)

File lib2to3/fixes/fix_imports.py

             # Module usage could be in the trailer of an attribute lookup, so we
             # might have nested matches when "bare_with_attr" is present.
             if "bare_with_attr" not in results and \
-                    any([match(obj) for obj in attr_chain(node, "parent")]):
+                    any(match(obj) for obj in attr_chain(node, "parent")):
                 return False
             return results
         return False

File lib2to3/fixes/fix_next.py

 def is_subtree(root, node):
     if root == node:
         return True
-    return any([is_subtree(c, node) for c in root.children])
+    return any(is_subtree(c, node) for c in root.children)

File lib2to3/fixes/fix_renames.py

         match = super(FixRenames, self).match
         results = match(node)
         if results:
-            if any([match(obj) for obj in attr_chain(node, "parent")]):
+            if any(match(obj) for obj in attr_chain(node, "parent")):
                 return False
             return results
         return False