extend getattr()

Rotlaus rotlaus at gmail.com
Thu Jun 26 13:06:53 CEST 2008


Hello,

lets assume i have some classes:

class A(object):
    def __init__(self):
        b = B()

class B(object):
    def __init__(self):
        c = C()

class C(object):
    def __init__(self):
        pass

and now i wanna do something like this:

a=A()
c=getattr(a, 'b.c')

I know this doesn't work, but what can i do to get this or a similar
functionality to get it work for this sample and for even more nested
classes?

Kind regards,

Andre



More information about the Python-list mailing list