replace a method in class: how?

Maric Michaud maric at aristote.info
Mon Jun 26 21:21:33 EDT 2006


Le mardi 27 juin 2006 06:21, Bruno Desthuilliers a écrit :
> Maric Michaud a écrit :
> (snip)
>
> > In OOP Methods are defined in *classes* not in any arbitrary object
>
> Chapter and verse, please ? AFAIK, the first O in OOP stands for
> "object", not for "class" !-)
>
Hard to find it, indeed.

> Classes are just an implementation convenience, and the fact that the
> class-based model is the most usual one doesn't imply it's the only
> valid one.
Maybe, never been told of another one, do you think of javascript prototypes ? 
Well, there are no methods in this model, only functions.

> So there's no reason one shouldn't override (or add) a method 
> on a per-object basis. As a matter of fact, it's perfectly legal (and
> can be very convenient) to do so in Python.
I never saw the term "method" used for anything except for what it means for 
classes, and moreover, the class model, even if it's just an implementation, 
it's the one chosen by python.
For the common understanding of the model, IMHO, classes bind methods, 
instances bind functions.

-- 
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097



More information about the Python-list mailing list