summaryrefslogtreecommitdiff
path: root/compat.py
diff options
context:
space:
mode:
authorRémi Cardona <remi.cardona@free.fr>2014-07-28 23:02:46 +0200
committerRémi Cardona <remi.cardona@free.fr>2014-07-28 23:02:46 +0200
commita8ad07d5eeceadcc466f2d5f6e3274168b74a2a3 (patch)
tree7647069da0bd9ead74aaa4b25419e180ef18cfe1 /compat.py
parent7bc13c991f1d49b59e243e663406ec4c0845a2a7 (diff)
downloadlogilab-common-a8ad07d5eeceadcc466f2d5f6e3274168b74a2a3.tar.gz
[compat] Deprecate any() and all() (related to #264017)
They're builtin since python 2.5, so we can remove our implementation.
Diffstat (limited to 'compat.py')
-rw-r--r--compat.py29
1 files changed, 4 insertions, 25 deletions
diff --git a/compat.py b/compat.py
index 92e8808..a317402 100644
--- a/compat.py
+++ b/compat.py
@@ -91,31 +91,10 @@ except ImportError:
from logilab.common.deprecation import deprecated
-# Python2.5 builtins
-try:
- any = any
- all = all
-except NameError:
- def any(iterable):
- """any(iterable) -> bool
-
- Return True if bool(x) is True for any x in the iterable.
- """
- for elt in iterable:
- if elt:
- return True
- return False
-
- def all(iterable):
- """all(iterable) -> bool
-
- Return True if bool(x) is True for all values x in the iterable.
- """
- for elt in iterable:
- if not elt:
- return False
- return True
-
+# Other projects import these from here, keep providing them for
+# backwards compat
+any = deprecated('use builtin "any"')(any)
+all = deprecated('use builtin "all"')(all)
# Python2.5 subprocess added functions and exceptions
try: