• Jim Fulton's avatar
    Can now supply a string as the computed attribute function, in which · 506acb5c
    Jim Fulton authored
    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.
    506acb5c
ComputedAttribute.c 4.41 KB