Subclassing array

Alex Martelli aleaxit at yahoo.com
Thu May 4 10:59:22 EDT 2006


TG <girodt at gmail.com> wrote:
   ...
> When I call Vector.__init__() in Stimulus, doesn't it also call __new__
> ? I don't understand the detail of callings to __new__ and __init__ in
> python inheritance ...

Calling a (new-style) class does __new__ first, THEN calls the class's
__init__ on the resulting instance -- and the arguments you're passing
when calling the class go to both __new__ and __init__.


Alex



More information about the Python-list mailing list