overwriting method in baseclass

Harald Massa cpl.19.ghum at spamgourmet.com
Mon Feb 7 01:33:03 EST 2005


Hello!

I am using a library (= code of so else) within Python. Somewhere in this 
library there is:

class foo:
    	def baa(self, parameters):
         print "something"
         self.baazanan(some other parameters)


class mirbo(foo):
      def baazanan(self, lalala):
          print "heylo tada"

class fujiko(foo):
      def baazanan(self, ltara):
          print "sing a song with me"


....


now I want to change the common baa-method. so that

def baa(self, parameters):
      print "soemthing special"
      self.baazanan(some other parameters)

Of course, I use a Python- and GPL-Licence compatible library, I can 
change the source of foo, and use my changed library.

But someday, it happened before, there will be an update by the publisher 
to that library.... and I have to do all again.

So, what is the most elegant solution to administer these changes? 

Harald



More information about the Python-list mailing list