[Python-Dev] Breaking calls to object.__init__/__new__

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 22 12:26:37 CET 2007


Blake Ross wrote:
> C++ ensures that virtual bases
> are only constructed once,

As far as I remember, C++ ensures this by not calling
the base constructors automatically at all, leaving
you to explicitly call the constructors of all the
virtual bases that you inherit.

You could adopt the same solution in Python - have
methods called init_xxx in each class Xxx, and call
them all from the __init__ method of the most-derived
class.

--
Greg


More information about the Python-Dev mailing list