Handling Property and internal ('__') attribute inheritance and creation

Christian Heimes lists at cheimes.de
Fri Aug 15 17:08:19 EDT 2008


Bruno Desthuilliers wrote:
> How often do you really need to override a property ? (hint : as far as 
> I'm concerned, it never happened so far). Now you have two solutions : 
> either redefine the whole property in the derived class, or, if you 
> really intend your property to be overriden, provide a "template method" 
> hook.

In Python 2.6 and 3.0 you can override the setter, getter or deleter of 
a property in a subclass. You may be able to find a pure Python 
implementation written by Guido. My C implementation in the core works 
almost the same.

Christian




More information about the Python-list mailing list