Just a note of clarification:
The @deco syntax is called *decorator* syntax. Classes with a __get__ method are called *descriptors*.
Okay, I think I get the idea. I didn't know about the @deco syntax, but it seems to be straightforward. And I got myself updated a little bit on descriptors and static methods.
On Dé Céadaoin, Ean 26, 2005, at 17:09 America/Chicago, Jeff Shannon wrote:
You could try making D a container for B instead of a subclass:
Thank you for the solution. I'll need to have a closer look at it. However it seems like the decision whether to do "some expensive calculation" or not is delegated to the exterior of class D. Different classes that instanciate D would need to know what has been going on elsewhere. That might complicate things.
I'll go ahead and try with the descriptors first.
Thanks for all the help,
Christian
-- http://mail.python.org/mailman/listinfo/python-list