Can now supply a string as the computed attribute function, in which
case, the ComputedAttribute object does a simple getattr. This is a simple way to set up aliases. For example:: class foo: spam=ComputedAttribute('eggs') is equivalent to: class foo: spam=ComputedAttribute(lambda self: self.eggs) Note that the simple alias version also avoids a function call.
Showing
Please register or sign in to comment