Proposed improved decorator syntax

Rob Williscroft rtw at freenet.co.uk
Thu Aug 5 21:47:38 EDT 2004


 wrote in news:mailman.1235.1091753699.5135.python-list at python.org in 
comp.lang.python:

> class foo:
>     def introduceNewFeature(self, someArgument, anotherArgument):
>         .decorate = [synchronized]
>         .accepts  = (int, int)
>         .author   = 'Chris King'
>         pass # whatever
> 
> 

AIUI it is intended that prefix '.' will be used at some point
with a 'with'/'using' keyword:

class Foo:
  def f( self ):
   with self:
    .member = value

But since we can have function's in function's and we already
have "special" member functions (__init__ etc):

class Foo:

  def method( self ):

    def __decorate__( func ):
      synchronized( func )

    __accepts__ = (int, int)
    __author__ = "whoever"

    pass

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list