replace a method in class: how?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Tue Jun 27 00:21:56 EDT 2006


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" !-)

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. 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.



More information about the Python-list mailing list