ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
[Tutor] Object Oriented References? and a couple of questions <--LONG
by Israel C. Evans other posts by this author
Aug 11 2001 2:25AM messages near this date
Fwd: Re: [Tutor] Issues with initializing lists | [Tutor] Re: Algebraic symbol manipulation program idea
Hello all,

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
that.

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
appreciated...

Thanks, 

~Israel~







__________________________________________________
FREE voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com


_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved