returning None if Paremeter key is unset can break Parameter.update

Issue #661 wontfix
Chaffra Affouda created an issue

The following modification in post.i should fix this.

def __setitem__(self, key, value):
    "Set the parameter 'key', with given 'value'"
    if (key == "this") and type(value).__name__ == 'SwigPyObject':
        self.__dict__[key] = value
        return
    if key not in self._get_parameter_keys():
        raise KeyError("'%s' is not a parameter"%key)
    if not isinstance(value,(int,str,float,bool)) and (value is not None):
        raise TypeError("can only set 'int', 'bool', 'float' and 'str' for parameter %s"%key)
    par = self._get_parameter(key)
    if isinstance(value,bool):
        par._assign_bool(value)
    elif value is None:
        pass
    else:
        par._assign(value)

Comments (4)

  1. Log in to comment