In article <mailman.1530.1368196163.3114.python-l...@python.org>, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote:
> It's not just because of exceptions. In C++ virtual method calls in a > constructor for a class A will always call the methods of class A even > if the object being constructed is actually of a subclass B because > the B part of the object isn't initialised when the A constructor is > called. There may be a better way to do this since I last used C++ but > as I remember it the two-phase pattern was a recommended way to > implement polymorphic behaviour during initialisation. Mind. Blown. One of the things I love (FSVO love) about C++ is that no matter how much I learn, there's always whole new areas of wonderment to explore behind doors I didn't even know existed. Thank you. I suppose, if I had a class like this, I would write a factory function which called the constructor and post-construction initializer. And then I would make the constructor protected. -- http://mail.python.org/mailman/listinfo/python-list