提交 b8d50641 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

fixed for python 2.4

上级 d1819ebf
...@@ -6,6 +6,7 @@ from copy import copy ...@@ -6,6 +6,7 @@ from copy import copy
from compile import Function, eval_outputs from compile import Function, eval_outputs
import gradient import gradient
import gof, gof.graph import gof, gof.graph
from gof.python25 import any
#TODO: consider moving this function / functionality to gradient.py #TODO: consider moving this function / functionality to gradient.py
......
...@@ -9,10 +9,16 @@ if sys.version_info[:2] < (2,5): ...@@ -9,10 +9,16 @@ if sys.version_info[:2] < (2,5):
if not element: if not element:
return False return False
return True return True
def any(iterable):
for element in iterable:
if element:
return True
return False
else: else:
# Only bother with this else clause and the __all__ line if you are putting # Only bother with this else clause and the __all__ line if you are putting
# this in a separate file. # this in a separate file.
import __builtin__ import __builtin__
all = __builtin__.all all = __builtin__.all
any = __builtin__.any
__all__ = ['all'] __all__ = ['all', 'any']
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论