[Python-Dev] Computed-attributes

Paul Prescod paul@prescod.net
Thu, 20 Jul 2000 12:56:27 -0500

Don Beaudry! The master returns to check on the upstarts.

Donald Beaudry wrote:
> ...
> One way of doing that, which I feel also makes things a bit more
> obvious, is to allow only a single routine per attribute: __attr_XXX__.

My first reaction was negative but it does simplify a bunch of stuff.
Inheritance is straightforward, calling a base class is straightforward,
implementation is simpler.

Overall, I like it!

> I agree that prohibiting it is the right idea.  The question is how.
> Permitting only one routine per attribute lets the traditional
> attribute lookup rules work and thus prevents head scratching when
> trying to find the code that actually maintains an attribute.  The
> cost is some additional burden on the writer of the __attr_XXX method
> (and some magic to distinguish the del case).

Don't follow that. Why not just have "get"/"set"/"del" opcodes?

 Paul Prescod - Not encumbered by corporate consensus
"Hardly anything more unwelcome can befall a scientific writer than 
having the foundations of his edifice shaken after the work is 
finished.  I have been placed in this position by a letter from 
Mr. Bertrand Russell..." 
 - Frege, Appendix of Basic Laws of Arithmetic (of Russell's Paradox)