A superclass using a child classes' methods

Kurt Schwehr schwehr at gmail.com
Wed Jun 24 11:22:19 EDT 2009

I'm trying to build an OO system for encoding and decoding
datapackets.  I'd like the parent class to have an encode function
that uses each of the child classes' packing methods.  It appears that
this works for attributes of children accessed by the parent, but not
for methods.  Is that right?  For attributes I found this example,
where the alphabet attribute is set in the child, but used in the


Should I just set an attribute in the child class and then call the
super's functionality making is pull the data from the attribute?


More information about the Python-list mailing list