preemptive OOP?
John Salerno
johnjsal at NOSPAMgmail.com
Thu Sep 28 14:04:58 EDT 2006
Ok, I have a new random question for today -- feel free to ignore and
get back to your real jobs! :)
Anyway, I'm creating a GUI (yes, all part of my master plan to
eventually have some sort of database application working) and it's
going to involve a wx.Notebook control. I think I have two options for
how I can do this. Within the class for the main window frame, I can say:
notebook = wx.Notebook(panel) # panel is parent of the Notebook control
This uses the default wx.Notebook class, and works just fine. But I was
thinking, is it a smart idea to do this instead:
class MyNotebook(wx.Notebook):
def __init__(self, parent):
wx.Notebook.__init__(self, parent)
and then call it from the main frame as:
notebook = MyNotebook(panel)
This seems to allow for future expansion of the customized Notebook
class, but at the same time I have no idea how or why I'd want to do that.
So my question in general is, is it a good idea to default to an OOP
design like my second example when you aren't even sure you will need
it? I know it won't hurt, and is probably smart to do sometimes, but
maybe it also just adds unnecessary code to the program.
More information about the Python-list
mailing list