import-checker: use any() and a genexp to avoid awkward for/else construction
authorAugie Fackler <raf@durin42.com>
Tue, 24 Dec 2013 19:10:04 -0500
changeset 20200 532fa12033e1
parent 20199 d87ed25733a1
child 20201 bc3b48b0f5c8
import-checker: use any() and a genexp to avoid awkward for/else construction
contrib/import-checker.py
--- a/contrib/import-checker.py	Sun Dec 22 21:27:00 2013 -0800
+++ b/contrib/import-checker.py	Tue Dec 24 19:10:04 2013 -0500
@@ -73,10 +73,7 @@
     for libpath in sys.path:
         # We want to walk everything in sys.path that starts with something
         # in stdlib_prefixes.
-        for prefix in stdlib_prefixes:
-            if libpath.startswith(prefix):
-                break
-        else:
+        if not any(libpath.startswith(p) for p in stdlib_prefixes):
             continue
         if 'site-packages' in libpath:
             continue