fixed caching bug with args having Nones

This commit is contained in:
Max Zwiessele 2014-02-28 12:08:16 +00:00
parent 83f5b9377a
commit 82a25d691b

View file

@ -1,4 +1,5 @@
from ..core.parameterization.parameter_core import Observable from ..core.parameterization.parameter_core import Observable
import itertools
class Cacher(object): class Cacher(object):
""" """
@ -40,9 +41,9 @@ class Cacher(object):
# TODO: WARNING !!! Cache OFFSWITCH !!! WARNING # TODO: WARNING !!! Cache OFFSWITCH !!! WARNING
# return self.operation(*args) # return self.operation(*args)
#if the result is cached, return the cached computation #if the result is cached, return the cached computation
state = [all(a is b for a, b in zip(args, cached_i)) for cached_i in self.cached_inputs] state = [all(a is b for a, b in itertools.izip_longest(args, cached_i)) for cached_i in self.cached_inputs]
if any(state): if any(state):
i = state.index(True) i = state.index(True)
if self.inputs_changed[i]: if self.inputs_changed[i]: