In article <mailman.1532.1368198547.3114.python-l...@python.org>, Chris Angelico <ros...@gmail.com> wrote:
> > Each language has its own set of best practices. Trying to write C++ > > code using Python patterns is as bad as trying to write Python code > > using C++ patterns. > > Agreed, in generality. But what is actually gained by hiding data from > yourself? You're not hiding it from yourself. You're hiding it from the other people who are using your code and may not understand all the subtle gotchas as well as you do. In the calling-virtual-methods-in-the-constructor case we're talking about here, constructing an object by calling B() without immediately following it up with a call to B::PostInit() is dangerous. If you document that you shouldn't do that, but allow it anyway, people will do it. Better to disallow it completely. People will bitch when their code doesn't compile, but that's better than compiling and running and producing the wrong results. You solve this problem in Python by simply having the constructor do the right thing. -- http://mail.python.org/mailman/listinfo/python-list