OO
I have just started to use classes and methods etc in Python. Up until now, my projects have been pretty small and not really needed an object-oriented approach. What I'm doing at the moment (text processing, more or less) is definitely aided by it. But I still have a feeling I'm not exploiting OO to the maximum benefit. especially because I haven't used inheritance at all...
For example I have a class called Event. After some text processing, I end up with a list of Events. I wrote two functions to use with the list:
* listmerge (takes two lists of Events)
* eventsearch (takes a list of Events and a string)
I feel like there should be some way I make these functions methods. But they act on lists, not Events directly.
Is the answer to make some kind of inherited EventList thing? I think that's what I want. I need a push in the right direction here. :) I find OO examples tend to be ridiculous and unhelpful. But now I have a specific problem, they will start to be useful.
For example I have a class called Event. After some text processing, I end up with a list of Events. I wrote two functions to use with the list:
* listmerge (takes two lists of Events)
* eventsearch (takes a list of Events and a string)
I feel like there should be some way I make these functions methods. But they act on lists, not Events directly.
Is the answer to make some kind of inherited EventList thing? I think that's what I want. I need a push in the right direction here. :) I find OO examples tend to be ridiculous and unhelpful. But now I have a specific problem, they will start to be useful.
