class methods vs. functions

Egbert Bouwman egbert.list at
Thu Jul 15 18:00:10 CEST 2004

On Thu, Jul 15, 2004 at 02:10:06PM +0200, Jacek Generowicz wrote:

> Why treat it as private, if it isn't marked as private? If it isn't
> marked as private, then it's part of the interface. If it's part of
> the interface, then it is intended for use by clients. If it's
> intended for use by clients, then use it.

My impression is that you can hardly call this OOO:
Object Oriented Orthodoxy. For instance, from the GOF I learned:
- the object's internal state can not be accessed directly
- operations are the only way to change an object's internal state
- requests (or messages) are the only way to get an object 
  to execute an operation
- a signature consists of an operation's name, parameters and return value
- the interface to an object is the set of all signatures of its operations

It is not easy to find definitions of 'interface' in python books,
but I cannot find descriptions that contradict the GOF.

And now you suggest that everything that is accessible is part
of the interface. I think I prefer the orthodoxy.

I suppose that is what you mean when you say:
> Be careful not to let Java or C++ (or anyone strongly influenced by
> them) to shape your understanding of object oriented programming. You
> would be doing yourself a disservice.
but I need more explanations, arguments, references.

You seem to encourage the following practice:
    >>> class C: pass
    >>> c = C()
    >>> c.x = 9
because the internal state of c is not private, 
so it is part of the interface, so it is intended for use,
so I should use it.

I finally got rid of my goto's, and now you do this to me.

Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991

More information about the Python-list mailing list