Implicit initialization is EXCELLENT

Ian Kelly ian.g.kelly at gmail.com
Wed Jul 6 18:26:48 CEST 2011


On Wed, Jul 6, 2011 at 12:49 AM, Ulrich Eckhardt
<ulrich.eckhardt at dominolaser.com> wrote:
> Mel wrote:
>> In wx, many of the window classes have Create methods, for filling in
>> various attributes in "two-step construction".  I'm not sure why, because
>> it works so well to just supply all the details when the class is called
>> and an instance is constructed.  Maybe there's some C++ strategy that's
>> being supported there.
>
> Just guessing, is it legacy, C-with-classes code rather than C++ code
> perhaps? Haven't looked at wx for a while. Such code typically lacks
> understanding of exceptions, which are the only way to signal failure from
> e.g. constructors.

No, wx is C++ through and through.  For the why of it, see:

http://wiki.wxpython.org/TwoStageCreation

The "More Details" section is particularly illuminating.



More information about the Python-list mailing list