Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
I'd be inclined to see this as a bug in your code, if you are causing side-effects from `__getattribute__`. If you don't want attribute access to cause side-effects, then don't put code in `__getattribute__` that causes side-effects :-) isinstance has to check the object's `__class__`, if it has one. To do that it has to look at obj.__class__, which your class intercepts using `__getattribute__` and causes a side-effect. Overloading `__getattribute__` is perilous, because it intercepts *all* instance attribute lookups. In my opinion, one should (almost?) never overload the `__getattribute__` method, it is safer to overload `__getattr__`. In any case, I don't think there is anything to fix here. Dan has not responded since his initial bug report nearly four years ago, so I'm inclined to close this as "Not A Bug". Unless somebody gives a more convincing reason why the current behaviour is wrong, I think we should close it. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32683> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com