List of all Python dunder methods - Which ones do you need to implement to correctly proxy an object?
问题 I'm trying to create an object proxy. Attribute/property lookup can be done by simply implementing the __getattribute__ , __setattr__ and __delattr__ methods. However, other functionalities like len(x), x[], bool(x) require other dunder methods like __len__, __getitem__, __bool__ to be implemented. If you don't implement these on the proxy class, but the object you're proxying supports them, your proxy will be incomplete and cause runtime errors. I would therefore like to have a comprehensive