[Python-Dev] string-valued fget/fset/fdel for properties

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Nov 24 00:28:07 EST 2003


Guido:

> I'm curious about the use case that makes you feel the need for speed.
> I would expect most properties not to simply redirect to another
> attribute, but to add at least *some* checking or other calculation.

I suspect he's thinking of cases where you only want to wrap special
behaviour around *some* of the accessors, e.g. you want writing to a
property to be mediated by a function, but reading it can just be a
normal attribute access. Currently, you're forced to pay the price of
a function call for both reading and writing in this case.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list