branch | v0.6.x |
changeset 224 | 7e9874a50d92 |
parent 219 | 0b6ce895e1dc |
--- a/VirtualMailManager/pycompat.py Mon Mar 01 02:31:03 2010 +0000 +++ b/VirtualMailManager/pycompat.py Mon Mar 01 04:46:46 2010 +0000 @@ -21,3 +21,18 @@ if not element: return False return True + + +# http://docs.python.org/library/functions.html#any +try: + any = any +except NameError: + def any(iterable): + """Return True if any element of the *iterable* is true. If the + iterable is empty, return False. + + """ + for element in iterable: + if element: + return True + return False