Why won't this decorator work?

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Jul 3 06:14:25 CEST 2011


Ian Kelly wrote:
> If it's not a callable, then the result
> will just be that something non-callable is bound to the "roll_die"
> name -- which could be useful, but is probably a bad idea in general.

There are legitimate uses -- for example, the following
is a convenient way of creating a read-only property:

   @property
   def foo(self):
     return self.calculate_value_of_foo()

-- 
Greg



More information about the Python-list mailing list