Extension without sub-classing?
bignose-hates-spam at and-zip-does-too.com.au
Tue Jun 3 04:55:11 CEST 2003
On Tue, 03 Jun 2003 02:17:35 GMT, Martin d'Anjou wrote:
> Is it possible to extend a python class without sub-classing?
Why do you want to? I can't see that it buys you anything, and it
causes all kinds of confusion when trying to use a class spread across
What is it you don't like about subclassing to extend functionality?
def start_engine( self ):
print "Engine started"
class car_with_brakes( car ):
def apply_brakes( self ):
print "Car stopped"
>>> vehicle = car_with_brakes()
\ "Homer, where are your clothes?" "Uh... dunno." "You mean Mom |
`\ dresses you every day?!" "I guess; or one of her friends." -- |
_o__) Lisa & Homer, _The Simpsons_ |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
More information about the Python-list