Extending methods

Alex new_name at mit.edu
Thu Jun 14 13:28:45 EDT 2001


> How does one extend a method in a class that has been inherited from
> another class?

class A:

    def method_name(self):

        print 'executing A.method_name'

class B(A):

    def method_name(self):

        print 'executing B.method_name'
        A.method_name(self)

b = B()
b.method_name()

HTH.
Alex.



More information about the Python-list mailing list