multiple inheritance super()
Jeremy Moles
jeremy at emperorlinux.com
Wed Jul 27 00:21:27 EDT 2005
Ignore my last response; just read it fully and realized how dumb my
response was. :)
On Wed, 2005-07-27 at 12:44 +0530, km wrote:
> Hi all,
>
> In the following code why am i not able to access class A's object attribute - 'a' ? I wishto extent class D with all the attributes of its base classes. how do i do that ?
>
> thanks in advance for enlightment ...
>
> here's the snippet
>
> #!/usr/bin/python
>
> class A(object):
> def __init__(self):
> self.a = 1
>
> class B(object):
> def __init__(self):
> self.b = 2
>
> class C(object):
> def __init__(self):
> self.c = 3
>
> class D(B, A, C):
> def __init__(self):
> self.d = 4
> super(D, self).__init__()
>
> if __name__ == '__main__':
> x = D()
> print x.a # errs with - AttributeError
>
More information about the Python-list
mailing list