class methods vs. functions

Egbert Bouwman egbert.list at
Thu Jul 15 10:28:51 CEST 2004

On Wed, Jul 14, 2004 at 03:38:40PM -0400, Christopher T King wrote:
> On 14 Jul 2004, beliavsky at wrote:
> > What are the pros and cons of defining a method of a class versus defining
> > a function that takes an instance of the class as an argument? 

>From a technical point of view Christopher's explanation seems to be OK,
but my limited studies of object oriented programming taught me that
from outside an object you should not use its data-attributes directly.
Rather you should send the object messages, ie use methods of this object.
So z.modules() seems to be the better idea, and modules(z) the worse one.

I suppose that this means that you should treat each name foo of a 
data-attribute as if it was called __foo.
Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991

More information about the Python-list mailing list