Python Attributes and Inheritance

Posted by user368186 on Stack Overflow See other posts from Stack Overflow or by user368186
Published on 2010-06-16T12:36:36Z Indexed on 2010/06/16 12:42 UTC
Read the original article Hit count: 145

Filed under:
|
|

Say I have the folowing code:

class Class1(object):

    def __init__(self):
        self.my_attr = 1
        self.my_other_attr = 2

class Class2(Class1):

    def __init__(self):
        super(Class1,self).__init__()

Why does Class2 not inherit the attributes of Class1?

© Stack Overflow or respective owner

Related posts about python

Related posts about inheritance