[Tutor] Re: OOP source code??

Andrei project5 at redrival.net
Sat Nov 8 10:48:22 EST 2003


John Duarte wrote on Fri, 7 Nov 2003 14:33:56 -0800:

> Can someone point out some python source code that does a good job of 
> illustrating "How it should be done"?

There's a lot of OOP Python code out there (in the Python libs too), so
it's hard to point out anything specific. Here's an example which I think
clearly illustrates OOP and inheritance at a very simple level:

http://mail.python.org/pipermail/tutor/2001-March/004010.html

> I don't want anybody to "do my homework for me", but the simplified examples I 
> have encountered have not prepared me for tackling my problem. So, I am 
> looking for some "real world" source that illustrates how OOP can be used to 
> provide solutions.

Hm... I think it's best to start small really. If you don't understand OOP,
staring at the Zope codebase won't be a lot of help I presume. IMO you'd be
better off coding something small and simple instead. If the example with
polygons is too small, try extending it and make a CAD-like storage system
which can store all kinds of different shapes and calculate areas,
circumferences, etc. You'd need a point class, a polygon class (with all
kinds of subclasses), etc.
Or a Jukebox-like application (for ease of use without actually having it
produce sound) which can manage Collections of different types of Songs
(MP3, OGG, MIDI) and play random Songs from all Collections, or random
songs witin a Collection. The Jukebox itself could be a Collection of
Collections.

-- 
Yours,

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V
ernq gur yvfg, fb gurer'f ab arrq gb PP.




More information about the Tutor mailing list