As you can see here: https://github.com/Korijn/observ/blob/master/observ/init.py#L146
I’m trying to implement observable containers. That is, list, set and dict types that emit a signal when they are read from, and when they are mutated. I can simply overload all the methods I can think of as you can see in the code linked above, but I’d rather use something like a metaclass or a class decorator to dynamically wrap all relevant methods.
However, I am clueless on the following:
(1) how to dynamically select the “proper” set of methods to wrap?
dir also yields things like
__getattribute__ which I don’t think are appropriate to wrap
(2) how to determine if the method I’m wrapping is either “read” or “write” (since that determines which signal to emit)
Do you have any advice for me?