1. Benoit Boissinot
  2. mercurial/crew/tonfa

Commits

Steve Losh  committed 7a6b5f8

util: use the built-in any() and all() methods if they are available

  • Participants
  • Parent commits 6b354a7
  • Branches stable

Comments (0)

Files changed (1)

File mercurial/util.py

View file
         if prevhandler is not None:
             signal.signal(signal.SIGCHLD, prevhandler)
 
-def any(iterable):
-    for i in iterable:
-        if i:
-            return True
-    return False
+try:
+    any, all = any, all
+except NameError:
+    def any(iterable):
+        for i in iterable:
+            if i:
+                return True
+        return False
 
-def all(iterable):
-    for i in iterable:
-        if not i:
-            return False
-    return True
+    def all(iterable):
+        for i in iterable:
+            if not i:
+                return False
+        return True