diff options
author | Rémi Cardona <remi.cardona@free.fr> | 2014-07-28 23:02:46 +0200 |
---|---|---|
committer | Rémi Cardona <remi.cardona@free.fr> | 2014-07-28 23:02:46 +0200 |
commit | a8ad07d5eeceadcc466f2d5f6e3274168b74a2a3 (patch) | |
tree | 7647069da0bd9ead74aaa4b25419e180ef18cfe1 /compat.py | |
parent | 7bc13c991f1d49b59e243e663406ec4c0845a2a7 (diff) | |
download | logilab-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.py | 29 |
1 files changed, 4 insertions, 25 deletions
@@ -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: |