[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: > 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)"): > > > #====================================================================== > =============== class Field_Collection: > fieldList = [] > > def add(self, name, size, compression, responseValue, value, > description): > self.fieldList.append( Field(name, size, compression, > responseValue, value, description) ) > > def update(self): > print "updating field" > > def get(self): > print "getting field" > > def printer(self): > for x in self.fieldList: > x.printer() > > > #====================================================================== > =============== > > > class MSD(Field_Collection): > standard = "" > decField = "" > > def printer(self): > print "Standard: " + self.standard > print "decField: " + self.decField > Field_Collection.printer(self) > > #====================================================================== > =============== > > w2k, python 2.3 >
I added these lines to your code: foo = MSD() foo.printer() And it worked perfectly (python 2.3.3). You would get that error if you accidentally did something like: foo = MSD() MSD.printer() # oops, should be foo.printer() -- http://mail.python.org/mailman/listinfo/python-list