jangada.serialization.Serializable.__eq__#
- Serializable.__eq__(other)#
Compare equality based on copiable properties.
Two Serializable objects are equal if they are the same type and all their copiable properties have equal values.
- Parameters:
- otherAny
The object to compare with.
- Returns:
- bool
True if objects are equal, False otherwise.
Notes
Only copiable properties are compared. Non-copiable properties (like caches or temporary state) are ignored.
For nested Serializable objects, comparison is recursive. For NumPy arrays, uses numpy.all() for element-wise comparison.
Examples
>>> class MyClass(Serializable): ... value = SerializableProperty(default=0) ... >>> obj1 = MyClass(value=42) >>> obj2 = MyClass(value=42) >>> obj3 = MyClass(value=99) >>> obj1 == obj2 True >>> obj1 == obj3 False
Different types are never equal:
>>> class OtherClass(Serializable): ... value = SerializableProperty(default=0) ... >>> obj4 = OtherClass(value=42) >>> obj1 == obj4 False