Module level descriptors or properties

Floris Bruynooghe floris.bruynooghe at gmail.com
Tue Aug 21 08:48:59 EDT 2007


Hi

When in a new-style class you can easily transform attributes into
descriptors using the property() builtin.  However there seems to be
no way to achieve something similar on the module level, i.e. if
there's a "version" attribute on the module, the only way to change
that to some computation later is by using a getter from the start as
your public API.  This seems ugly to me.

Does anyone know of a better way to handle this?


Regards
Floris




More information about the Python-list mailing list