class implementation

Peter Otten __peter__ at web.de
Mon Sep 30 05:03:10 EDT 2013


markotaht at gmail.com wrote:

> Is there a way to give a class extra functions whidout editing the .py
> file where the class is located?

A clean way is subclassing:

import vehicles

class FlyingCar(vehicles.Car):
    def lift_off(self): 
        pass

flying_car = FlyingCar()
flying_car.lift_off()





More information about the Python-list mailing list