[Zope-Checkins] CVS: Zope2 - ComputedAttribute.c:1.4

Jim Fulton jim@digicool.com
Tue, 23 Jan 2001 09:37:21 -0500 (EST)


Update of /cvs-repository/Zope2/lib/Components/ExtensionClass
In directory korak.digicool.com:/tmp/cvs-serv9666

Modified Files:
	ComputedAttribute.c 
Log Message:
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.