summaryrefslogtreecommitdiff
path: root/Cython/Utils.py
diff options
context:
space:
mode:
authorMark Florisson <markflorisson88@gmail.com>2011-04-27 21:37:35 +0200
committerMark Florisson <markflorisson88@gmail.com>2011-04-27 21:37:35 +0200
commitae59c5a0eb187701e88644c10511c3b05060563e (patch)
treed1171e38b05ef28755a28ee60f305ead0c09b4d8 /Cython/Utils.py
parentcbc3ddcfa51ba5e0e932ff183a903f9deed1349f (diff)
downloadcython-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.py18
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