Alternative decorator syntax decision

Jess Austin jess.austin at gmail.com
Tue Aug 24 16:02:41 EDT 2004


Paul Morrow <pm_mon at yahoo.com> wrote in message news:<mailman.2088.1093052072.5135.python-list at python.org>...
> > By what kind of black magic would setting the property __synchronized__ to
> > True would make that function synchronized ? And how can I define my own
> > decorators then ?
> 
> There would be two kinds of decorators.  Those that are simply 
> informative (like __author__ or __version__), and those that have 
> side-effects (like __metaclass__, __synchronized__, __automethods__, 
> etc.).  Those with side-effects would be implemented as special functions...
> 
>      def synchronized(func, trueOrFalse):
>          __decorator__ = True
>          __author__ = 'Billy Batson'
>          __version__ = '0.1'
>          #
>          # perform the synchronized operation on func...
>          #

How would the parser know the difference between informative function
variables like "__author__" and your special side-affecting function
variables?

I-like-J2-ly,
Jess



More information about the Python-list mailing list