This seems to work: class mystr(str): def HexRepr(self): print 'A hex on ye!' and so does this: class mystr( type('anystring') ): def HexRepr(self): print 'A hex on ye!'