help with my first use of a class

James Stroud jstroud at mbi.ucla.edu
Fri Oct 20 14:01:04 EDT 2006


Fulvio wrote:
> ***********************
> Your mail has been scanned by InterScan MSS.
> ***********************
> 
> 
> On Friday 20 October 2006 14:34, James Stroud wrote:
>> You really don't need classes for this
> 
> I'm in that matter too. Doesn't classes make the main program neater?
> Fundamentally OOP is the way to assemble ready objects to get a "thing" 
> working, rather than worry about any single code line.
> Is this a concept of python?

I don't really have formal programming training, but it is increasingly 
becoming my experience that OOP is but one ingredient in a good program. 
It can be left out or it can be mixed with other ingredients for a nice 
effect. Take for example the "file" and "open" built-ins. Calling both 
creates a file object, but the latter, which is the preferred to open a 
file, is actually a function rather than a class. So even the python 
designers did not constrain themselves to any single "style".

I think the trick is to identify when a class would make more sense than 
a collection of subroutines, etc.

James



More information about the Python-list mailing list