[Tutor] Object Oriented References? and a couple of questions <--LONG
Israel C. Evans
Fri, 10 Aug 2001 19:25:42 -0700
I'm trying to hack my way into the verdant valley that is Pythonic Object
Orientism. Would anybody have any recommendations for info on the subject?
Other than general interest in the subject, I'm trying to do something
right now, that might work well with OOP(i'd know for sure, if I was
more familiar with the subject). The example I have right now goes a
little something like this...
I've got a Cook who will scan a directory for ingredients, sift them
so that we are using only the ingredients we want, and then cook up a
bunch of Python Objects. Then I've got a Host who will deal with the
Diners and handle all of their requests and make sure everyone gets what
they need. I've also got a number of Recipies (object templates) for
The Cook to use. This is how I'm thinking I'll lay things out, let me
know if this isn't the best OO way to do things.
Now I'd like to break down the Cook to highlight some of the questions
that I had.
The Cook will first scan a directory, and make a list of all the files.
This will be his Pantry.
He will then Sift through the pantry for the files required by the Recipe.
This will create a list of files stripped of their extensions and such
that will be refered to as the Ingredients. These Ingredients will be
used to Bake a bunch of objects that I plan to use later.
When I'm setting up the Cook class I'm thinking the gather(), sift(),
and bake() will be methods of the class, and the pantry, ingredients
and recipe are all attributes(?). When I set up the __init__function
would I want to set it up like this...
def __init__(self, pantry, ingredients, recipe):
self.pantry = pantry
self.ingredients = ingredients
self.recipe = recipe
and then call the Cook methods to create the values of the attributes(still
don't know if that is the right terminology)? If so when would I do
I'm really foggy on how to properly use classes to create objects and
then use those objects. As you can see, I'm in dire need of a good explanation.
Sorry for the lengthy rambling message, but any help would be most sincerely
FREE voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com