diff --git a/tiramisu/api.py b/tiramisu/api.py index d788d10..df43aac 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -576,7 +576,16 @@ class TiramisuOptionValue(CommonTiramisuOption): self.config_bag) @count - def _len(self): + def _len_master(self): + """length of master option (only for slave option)""" + option = self._get_option() + # for example if index is None + if '_length' not in vars(self): + self._length = self.subconfig.cfgimpl_get_length() + return self._length + + @count + def _len_slave(self): """length of slave option (only for slave option)""" option = self._get_option() # for example if index is None @@ -589,8 +598,11 @@ class TiramisuOptionValue(CommonTiramisuOption): return self._list elif name == 'pop' and self._get_option().impl_is_master_slaves('master'): return self._pop - elif name == 'len' and self._get_option().impl_is_master_slaves('slave'): - return self._len + elif name == 'len': + if self._get_option().impl_is_master_slaves('slave'): + return self._len_slave + if self._get_option().impl_is_master_slaves('master'): + return self._len_master raise APIError(_('{} is unknown').format(name)) @count