author | Pascal Volk <neverseen@users.sourceforge.net> |
Mon, 01 Mar 2010 04:46:46 +0000 | |
branch | v0.6.x |
changeset 224 | 7e9874a50d92 |
parent 223 | 5c7b7cbb01cd |
child 225 | a51809f7940b |
--- 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