Extending base class methods

Steve Juranich sjuranic at gmail.com
Tue Apr 19 10:21:13 EDT 2005


On 19 Apr 2005 07:01:10 -0700, henrikpierrou at hotmail.com
<henrikpierrou at hotmail.com> wrote:
> Any ideas why this does not work? I get the error "TypeError: unbound
> method printer() must be called with Field_Collection instance as first
> argument (got MSD instance instead)"):

My suggestion would be to make Field_Collection inheirit from
"object".  Then you can make use of the "super" call inside of MSD. 
It would look something like this:

class Field_Collection(object):
    # Some stuff.

class MSD(Field_Collection):
    # More stuff
    def printer(self):
        print "Standard: " + self.standard
        print "decField: " + self.decField
        super(MSD, self).printer()


HTH

-- 
Steve Juranich
Tucson, AZ
USA



More information about the Python-list mailing list