"Paul McGuire" typed: > Here's a suggestion: use new-style classes. Have _BaseEntity inherit > from object, allows you to use super for invoking methods on super > classes. Instead of: > class Entity(_BaseEntity): > def __init__(self, type, x = 0, y = 0): > _BaseEntity.__init__(self, type, x, y) > > You enter: > class Entity(_BaseEntity): > def __init__(self, type, x = 0, y = 0): > super(Entity,self).__init__(type, x, y) > > This makes it easier to update your inheritance hierarchy later. New- > style classes have other benefits too.
I am still a beginner to Python, but reading that made me think on impluse, "What happens in case of one class inheriting from two or more different classes?" Having written a small test case and testing it, I find that super().__init__() calls the __init__() of the first of the class in the list of classes from which the calling class inherits. For example: class C(A, B): def __init__(self): super(C, self).__init__() calls A's __init__ explicity when an instance of C is instantiated. I might be missing something. I didn't know that. -- Ayaz Ahmed Khan A witty saying proves nothing, but saying something pointless gets people's attention. -- http://mail.python.org/mailman/listinfo/python-list