Extension without sub-classing?
Martin d'Anjou
point14 at magma.ca
Mon Jun 2 22:17:35 EDT 2003
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?
Thanks,
M.
More information about the Python-list
mailing list