[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Function Inheritance



Kevin wrote:
Don't forget Python supports multiple inheritance as well, which can be very useful.

So that'd be like so:

class Basic:
  def __init__(self):
    pass
  def DoStuff(self):
    print "Hello World"

class Advanced( Basic, SomeOtherClass ):
  def __init__(self):
    Basic.__init__(self)
    SomeOtherClass.__init__(self)

Basically, putting my basic functions into a class just for the sake of copying them all over into a new class at once. I thought multiple inheritance was kind of frowned upon...? But it does sound like the best route to do what I'm doing in a tidy and reliable way. Thanks to everyone.