Creating subclassess (newbie)

Peter Hansen peter at engcorp.com
Mon Jun 21 16:53:45 CEST 2004


Adam wrote:

> I have a subclass I want to create- my intuition told me
> that it would be done like this:
> 
> class MainClass:
> 	class SubClass:
> 		code...
> 	subclassinstance = SubClass()
> mainclassinstance = MainClass()

Have you followed through the tutorial in the documentation?
The section on classes covers inheritance in a basic way.
See
http://www.python.org/doc/current/tut/node11.html#SECTION0011500000000000000000

-Peter



More information about the Python-list mailing list