diff options
author | Mark Florisson <markflorisson88@gmail.com> | 2011-04-27 21:37:35 +0200 |
---|---|---|
committer | Mark Florisson <markflorisson88@gmail.com> | 2011-04-27 21:37:35 +0200 |
commit | ae59c5a0eb187701e88644c10511c3b05060563e (patch) | |
tree | d1171e38b05ef28755a28ee60f305ead0c09b4d8 /Cython/Utils.py | |
parent | cbc3ddcfa51ba5e0e932ff183a903f9deed1349f (diff) | |
download | cython-ae59c5a0eb187701e88644c10511c3b05060563e.tar.gz |
Fix compiler crash with type inferencing and add all() and any() to Utils
Diffstat (limited to 'Cython/Utils.py')
-rw-r--r-- | Cython/Utils.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Cython/Utils.py b/Cython/Utils.py index abebe312e..647b6e25a 100644 --- a/Cython/Utils.py +++ b/Cython/Utils.py @@ -221,3 +221,21 @@ def none_or_sub(s, data): else: return s % data +# all() and any() are new in 2.5 +try: + # Make sure to bind them on the module, as they will be accessed as + # attributes + all = all + any = any +except NameError: + def all(items): + for item in items: + if not item: + return False + return True + + def any(items): + for item in items: + if item: + return True + return False |