property() usage - is this as good as it gets?

George Sakkis george.sakkis at gmail.com
Fri Aug 22 14:06:03 EDT 2008


On Aug 22, 12:18 pm, David Moss <drk... at gmail.com> wrote:

> Hi,
>
> I want to manage and control access to several important attributes in
> a class and override the behaviour of some of them in various
> subclasses.
>
> Below is a stripped version of how I've implemented this in my current
> bit of work.
>
> It works well enough, but I can't help feeling there a cleaner more
> readable way of doing this (with less duplication, etc).
>
> Is this as good as it gets or can this be refined and improved
> especially if I was to add in a couple more attributes some fairly
> complex over-ride logic?

A small improvement as far as overriding goes is the OProperty recipe:
http://infinitesque.net/articles/2005/enhancing%20Python's%20property.xhtml

George



More information about the Python-list mailing list