[Tutor] Would an OOP approach be simpler?

Kent Johnson kent_johnson at skillsoft.com
Sat Oct 23 02:46:17 CEST 2004

Your approach looks fine to me. The functions are clean and distinct.

Beginners seem to have a lot of trouble understanding when to use classes. 
I have written an article showing some  common reasons for using classes. 
You can read it here: http://www.pycs.net/users/0000323/stories/15.html


At 10:22 PM 10/18/2004 +1300, you wrote:
>Hi all,
>This module (code below), is comprised of functions, which are run by
>a main function, which just passes bits of data around.
>Still trying to 'reconfigure my brain' (as several OOP tutorials put
>it), to understand
>the 'OOP paradigm' as nearly every OOP site puts it. At the very
>least, repartition my brain and install an OOP OS in a separate
>section. : )
>My module is pretty much going to do one thing (get emails, and dump
>their attachments in a directory for another module to extract info,
>which will pass the info to another module which will generate a csv
>of the extracted data, and email it again, all feeding back at
>appropriate times to a small GUI), and all the bits of data being
>flung from function to function (in quite a linear sequence), will be
>self-contained within that module.
>I can see two functions which may be used by other modules, but the
>values they use won't change, they'll just hand them to different
>functions to play with (i.e the load cfg module will load the config
>file, and pass the information to a function which allows the user to
>change the config, and the second function will then save the config)
>I really need a situation that screams 'objects are the only way' to
>work on to comprehend why OOP = good I think. The OOP tutorials I've
>found tend to be OOP for the sake of OOP...
>Thoughts appreciated. (And there are several errors in the posted
>code, like my except clause when trying to login, but that's because I
>haven't gotten around to that yet. And some are typos. : )  )
>Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list