On Thu, 09 May 2013 06:08:25 -0500, Wayne Werner wrote: > Ah, that's it - the problem is that it introduces /Temporal Coupling/ to > one's code: http://blog.ploeh.dk/2011/05/24/DesignSmellTemporalCoupling/
Good catch! That's not the blog post I read, but that's the same concept. "Temporal Coupling" -- yes, that is an excellent description of the problem. > You don't ever want a class that has functions that need to be called in > a certain order to *not* crash. That's fine if you have to call them in > a certain sequence in order to get the correct data - that's what > programming is all about, after all. But if you provide me a class with > a constructor you better make sure that when I do this: > > thing = YourSuperAwesomeClass() > thing.do_stuff() > > that I don't get some horrid stack trace ending with > > InvalidStateError: initialize() needs to be called before > do_stuff() > > Or something worse. Exactly. Thank you Wayne, that's a great help. -- Steven -- http://mail.python.org/mailman/listinfo/python-list