Closed cpaniaguam closed 4 months ago
https://github.com/lnccbrown/HSSM/blob/2b8fadbd1098c54e449ba95dbec963eb7d5a4617/src/hssm/param.py#L87-L95
One could use the object's internal dict and use its update method self.__dict__.update(kwargs).
self.__dict__.update(kwargs)
For validation one could check whether there are extra attrs in kwargs and react accordingly. For example:
extra_attrs = kwargs.keys() - self.__dict__.keys() if extra_attrs: raise ValueError(f"Invalid attrributes: {', '.join(extra_attrs)}")
Add tests for the update method.
https://github.com/lnccbrown/HSSM/blob/2b8fadbd1098c54e449ba95dbec963eb7d5a4617/src/hssm/param.py#L87-L95
One could use the object's internal dict and use its update method
self.__dict__.update(kwargs)
.For validation one could check whether there are extra attrs in kwargs and react accordingly. For example: