[Python-checkins] r76506 - in sandbox/trunk/2to3/lib2to3/fixes: fix_imports.py fix_next.py fix_renames.py
benjamin.peterson
python-checkins at python.org
Wed Nov 25 01:34:31 CET 2009
Author: benjamin.peterson
Date: Wed Nov 25 01:34:31 2009
New Revision: 76506
Log:
use generator expressions in any()
Modified:
sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py
sandbox/trunk/2to3/lib2to3/fixes/fix_next.py
sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py
Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Wed Nov 25 01:34:31 2009
@@ -108,7 +108,7 @@
# 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
Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_next.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_next.py (original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_next.py Wed Nov 25 01:34:31 2009
@@ -99,4 +99,4 @@
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)
Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py (original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py Wed Nov 25 01:34:31 2009
@@ -49,7 +49,7 @@
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
More information about the Python-checkins
mailing list