[Python-Dev] Re: Re: Call for defense of @decorators

Phillip J. Eby pje at telecommunity.com
Tue Aug 10 22:31:16 CEST 2004


At 02:03 PM 8/10/04 -0400, Chris King wrote:
>On Tue, 10 Aug 2004 13:21:42 -0400, Phillip J. Eby
><pje at telecommunity.com> wrote:
>
> > This doesn't apply to other decorators.  For example, some decorators turn
> > a function into a property.
>
>Ew.  If you did that, you'd be declaring get properties one way (with
>decorators) and get/set properties another (using property()).

Google "property_getter", and you'll find an implementation for this:

     @property_getter
     def foo(self):
         return self.__foo

     @property_setter
     def foo(self,value):
         self.__foo = value

     @property_deleter
     def foo(self):
         del self.__foo



More information about the Python-Dev mailing list