instance attributes not inherited?
Dan Sommers
me at privacy.net
Sun Jan 15 22:13:28 EST 2006
On Sun, 15 Jan 2006 20:37:36 -0500,
"John M. Gabriele" <john_sips_teaz at yahooz.com> wrote:
> David Hirschfield wrote:
>> Nothing's wrong with python's oop inheritance, you just need to know
>> that the parent class' __init__ is not automatically called from a
>> subclass' __init__. Just change your code to do that step, and you'll
>> be fine:
[example snipped]
> How does it help that Parent.__init__ gets called? That call simply
> would create a temporary Parent object, right? I don't see how it
> should help (even though it *does* indeed work).
The __init__ method is an *initializer*, *not* a constructor. By the
time __init__ runs, the object has already been constructed; __init__
just does extra initialization.
Regards,
Dan
--
Dan Sommers
<http://www.tombstonezero.net/dan/>
More information about the Python-list
mailing list