keripy
keripy copied to clipboard
Modify serialization interface to CesrSuber and its subclasses CatCesrSuber etc.
Currently the interface for serializaton requires passing in primitive instance in order to serialize. However when creating the Instance the .klas variable holds the class. So it would be possible to also allow simply passing in an already serialized value or tuple of values.
Also the ._ser method does not check that the .klas matches the ._ser instance types. This would allow someone to write the wrong serialization.
So might want to add a strict attribute that enforces subclass of ._ser to match .klas finally with strict then one could force des/ser using .klas when passed in already serialized. The last would avoid having to pass around the instances everywhere when the only purpose of the instances is to satisfy the interface for CatCesrSuber