On May 9, 5:20 pm, Joseph Turian <[EMAIL PROTECTED]> wrote: > If I have a property in a derived class, it is difficult to override > the get and set functions: the property's function object had early > binding, whereas the overriden method was bound late. > This was previously discussed: > http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > Could someone demonstrate how to implement the proposed solutions that > allow the property to be declared in the abstract base class, and > refer to a get function which is only implemented in derived classes?
Using the overridable property recipe [1], it can be written as: class AbstractFoo(object): def _getFoo(self): raise NotImplementedError('Abstract method') def _setFoo(self, signals): raise NotImplementedError('Abstract method') foo = OProperty(_getFoo, _setFoo) HTH, George [1] http://infinitesque.net/articles/2005/enhancing%20Python's%20property.xhtml -- http://mail.python.org/mailman/listinfo/python-list