Newbie inheritance question.

Ed Leafe ed at leafe.com
Sun Jan 16 09:24:15 EST 2005


On Jan 16, 2005, at 9:08 AM, bwobbones wrote:

> class two(one):
>    def __init__(self):
>        print "two"

	You need to specifically call the superclass's __init__ here in order 
for it to fire. Just add the line

        super(two, self).__init__()

as the first line of the subclass's __init__.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/




More information about the Python-list mailing list