jangada.serialization.SerializableProperty.remove_observer#

SerializableProperty.remove_observer(func: Callable[[object, T, T], None]) Self#

Remove an observer function.

Creates a new descriptor instance without the specified observer.

Parameters:
funcObserver

The observer function to remove.

Returns:
Self

A new SerializableProperty instance with the observer removed.

Raises:
KeyError

If the observer is not in the set of observers.

Notes

This method creates a new descriptor instance rather than modifying the existing one.

Examples

>>> def my_observer(instance, old, new):
...     print(f"Changed: {old} -> {new}")
...
>>> class MyClass:
...     value = SerializableProperty(observers={my_observer})
...
>>> # Remove the observer
>>> MyClass.value = MyClass.value.remove_observer(my_observer)