Thanks to Andreas Waldenburger, THC4k (http://stackoverflow.com/
questions/4247036/python-recursively-getattribute) and others for
their tips. I was able to find solution:
class Null(object):
def __repr__(self):
return ""
def __str__(self):
return ''
def __nonzero__(s
On Nov 22, 7:57 pm, Terry Reedy wrote:
> On 11/22/2010 10:46 AM, Roman Dolgiy wrote:
>
> > Hello,
>
> > I need to implement such behavior:
>
> > obj.attr1.attr2.attr3 --> obj.attr1__attr2__attr3
>
> obj.attr1.attr2.attr3 is parsed as ((obj.attr1).attr2).
On Nov 22, 6:04 pm, Andreas Waldenburger
wrote:
> On Mon, 22 Nov 2010 07:46:47 -0800 (PST) Roman Dolgiy
> wrote:
>
> > Hello,
>
> > I need to implement such behavior:
>
> > obj.attr1.attr2.attr3 --> obj.attr1__attr2__attr3
> > It looks like I have to
Hello,
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.
http://stackoverflow.com/questions/4247036/python-recursively-geta