From: Karl Hasselström Date: Tue, 11 Sep 2007 01:34:08 +0000 (+0200) Subject: Add the any() and all() utility functions from Python 2.5 X-Git-Tag: v0.14~95 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/c895bfc842095f487ac1ee18c36945a4f6900a63?ds=inline Add the any() and all() utility functions from Python 2.5 Signed-off-by: Karl Hasselström --- diff --git a/stgit/utils.py b/stgit/utils.py index 02e98e9..34c0f96 100644 --- a/stgit/utils.py +++ b/stgit/utils.py @@ -214,3 +214,18 @@ def make_patch_name(msg, unacceptable, default_name = 'patch'): suffix += 1 patchname = '%s-%d' % (patchname, suffix) return patchname + +# any and all functions are builtin in Python 2.5 and higher, but not +# in 2.4. +if not 'any' in dir(__builtins__): + def any(bools): + for b in bools: + if b: + return True + return False +if not 'all' in dir(__builtins__): + def all(bools): + for b in bools: + if not b: + return False + return True