Copy constructors

Guido van Rossum guido at
Mon Aug 13 14:35:24 CEST 2001

Roeland Rengelink <r.b.rigilink at> writes:

> I didn't mean to let object.__new__ call the init, which indeed
> looses flexibility What I did mean is the following change to
> type_call. I Have no idea what side effects I may have missed here,
> but it does exactly what I want.
>                 /* if the user defines his own __new__, 
>                    let him call __init_ explicitly */

The problem with this is that *all* overrides of __new__ would get the
new behavior.

If you want an initializer that's called by your class's __new__, just
give it a different name than __init__.

--Guido van Rossum (home page:

More information about the Python-list mailing list