Lazy Attributes
An example recipe. Here a custom descriptor and metaclass allow you to define a class with attributes that will only be computed when needed. When the value is finally computed, it is stored in the object.
The link address is: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/131495