[Piglit] [PATCH 06/11] profile.py: replace map() with generator expression

Dylan Baker baker.dylan.c at gmail.com
Fri Apr 25 13:27:38 PDT 2014


map() is considered semi-deprecated in python, since map() + lambda will
always be more expensive than a comprehension or generator expression.
---
 framework/profile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/profile.py b/framework/profile.py
index b297aaa..0793f61 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -89,7 +89,7 @@ class TestProfile(object):
         self.flatten_group_hierarchy()
 
         def matches_any_regexp(x, re_list):
-            return True in map(lambda r: r.search(x) is not None, re_list)
+            return any(r.search(x) for r in re_list)
 
         def test_matches(path, test):
             """Filter for user-specified restrictions"""
-- 
2.0.0.rc0



More information about the Piglit mailing list