Python recursively __getattribute__
usenot at geekmail.INVALID
Mon Nov 22 17:04:41 CET 2010
On Mon, 22 Nov 2010 07:46:47 -0800 (PST) Roman Dolgiy <tosters at gmail.com> wrote:
> I need to implement such behavior:
> obj.attr1.attr2.attr3 --> obj.attr1__attr2__attr3
> It looks like I have to override obj's class __getattribute__ and also
> use python descriptors somehow.
> Any help will be much appreciated.
Why? No, really: Why?
In that link you say that you need to do this to support legacy code. I still don't see how this would be necessary. If you need to support legacy code, doesn't that mean that the solution you're asking for already exists?
I really think you should go into detail about why you need this. I'm certain that there's a better solution to your problem. ("Better" being one that is reasonably easy to implement and maintain.)
To reach me via email, replace INVALID with the country code of my home
country. But if you spam me, I'll be one sour Kraut.
More information about the Python-list