Extension without sub-classing?
exarkun at intarweb.us
Tue Jun 3 04:38:04 CEST 2003
On Tue, Jun 03, 2003 at 02:17:35AM +0000, Martin d'Anjou wrote:
> Is it possible to extend a python class without sub-classing?
> For example, in file1.py
> class car:
> def start_engine(self):
> print "Started"
> And in file2.py, continue the declaration of the car class, without
> specializing it:
> extend car:
> def apply_breaks(self):
> print "You have stopped"
> I know the "extend" syntax is wrong, but I want to extend "car" without
> sub-classing. Is this possible and how?
"The problem is, of course, that not only is economics bankrupt but it has
always been nothing more than politics in disguise ... economics is a form
of brain damage." -- Hazel Henderson
More information about the Python-list