Re: Implicit initialization is EXCELLENT

2011-07-07 Thread Ian Kelly
On Thu, Jul 7, 2011 at 1:12 AM, Ulrich Eckhardt wrote: >>> 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. construc

Re: Implicit initialization is EXCELLENT

2011-07-07 Thread Ulrich Eckhardt
Ian Kelly wrote: > On Wed, Jul 6, 2011 at 12:49 AM, Ulrich Eckhardt > wrote: >> Mel wrote: >>> In wx, many of the window classes have Create methods, for filling in >>> various attributes in "two-step construction". [...] >> >> Just guessing, is it legacy, C-with-classes code rather than C++ code

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Steven D'Aprano
Stefaan Himpe wrote: > >> No! I was serious. I've spent *ages* trying to find the link to the >> article... if you know it, please share. > > Ok - I thought you were referring to some troll's rant with similar > title. I'm probably way off, but were you referring to the RAII technique? > > http

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Mel
Ian Kelly wrote: > On Wed, Jul 6, 2011 at 12:49 AM, Ulrich Eckhardt > 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 wh

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 12:49 AM, Ulrich Eckhardt 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 >>

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Stefaan Himpe
No! I was serious. I've spent *ages* trying to find the link to the article... if you know it, please share. Ok - I thought you were referring to some troll's rant with similar title. I'm probably way off, but were you referring to the RAII technique? http://en.wikipedia.org/wiki/Resource_A

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Steven D'Aprano
Stefaan Himpe wrote: >> Now, I have an ulterior motive in raising this issue... I can't find the >> original article I read! My google-fu has failed me (again...). I don't >> suppose anyone can recognise it and can point me at it? > > My sarcasm detector warns me not to add a link, although perha

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ulrich Eckhardt
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++ strateg

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ulrich Eckhardt
rantingrick wrote: > On Jul 5, 10:26 am, Steven D'Aprano > Since you can't do anything without a root window, I don't see the >> benefit in forcing the user to do so [create one explicitly]. > > The reason is simple. It's called order. It's called learning from day > one how the order of things ex

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread Chris Angelico
On Wed, Jul 6, 2011 at 1:45 PM, rantingrick wrote: >> If you force too much on people, they'll go >> elsewhere. > >  Why all this running away with tail between legs? >  Do these these people have extremely small eggs? >  I wish they would stand firm and put up a fight >  instead they're just cowa

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread rantingrick
On Jul 5, 9:44 pm, Chris Angelico wrote: > On Wed, Jul 6, 2011 at 11:53 AM, rantingrick wrote: > > So you would start drivers education class with road construction? Or > > the history of the internal combustion engine? Who cares about > > actually *driving* the car. > > I believe that starting d

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread Chris Angelico
On Wed, Jul 6, 2011 at 11:53 AM, rantingrick wrote: > So you would start drivers education class with road construction? Or > the history of the internal combustion engine? Who cares about > actually *driving* the car. > I believe that starting driver ed with some basics of how an internal combus

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread rantingrick
On Jul 5, 10:26 am, Steven D'Aprano wrote: > This is not strictly Python, although it is peripherally relevant. > > Some month or three ago, I read an article or blog post about API design, > specifically the wrong-headedness of insisting that callers manually > initialise instances using a separa

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread John Gordon
In John Gordon writes: > which praised the bendfists of implicit initialization. Wow, that's quite a typo! I meant "benefits", of course. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread John Gordon
In Stefaan Himpe writes: > > Now, I have an ulterior motive in raising this issue... I can't find the > > original article I read! My google-fu has failed me (again...). I don't > > suppose anyone can recognise it and can point me at it? > My sarcasm detector warns me not to add a link, althou

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread Stefaan Himpe
Hello, I agree with the contents of this post. I see a similar problem with API's requiring to initialize all kinds of data using setters/properties instead of receiving it in the initializer (or constructor). Python generally follows this design. Apart from files, I can't easily think off

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread Mel
Steven D'Aprano wrote: [ ... ] > Python generally follows this design. Apart from files, I can't easily > think off the top of my head of any types that require a separate > open/start/activate call before they are usable. It's also relevant to > tkinter, which will implicitly create a root window

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread Michel Claveau - MVP
Hi! +1 @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Implicit initialization is EXCELLENT

2011-07-05 Thread Steven D'Aprano
This is not strictly Python, although it is peripherally relevant. Some month or three ago, I read an article or blog post about API design, specifically the wrong-headedness of insisting that callers manually initialise instances using a separate step after creation. The argument goes, if your A