Copy constructors
Guido van Rossum
guido at python.org
Mon Aug 13 08:35:24 EDT 2001
Roeland Rengelink <r.b.rigilink at chello.nl> 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: http://www.python.org/~guido/)
More information about the Python-list
mailing list