Proposed improved decorator syntax

Rob Williscroft rtw at freenet.co.uk
Fri Aug 6 09:43:43 EDT 2004


Christopher T King wrote in news:Pine.LNX.4.44.0408060917330.30087-100000
@ccc6.wpi.edu in comp.lang.python:

> On 6 Aug 2004, Rob Williscroft wrote:
> 
>>  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
> 
> Which makes it all the more intuitive (def is acting similar to a with 
> block).
> 

Intuitivly I would then expect .decorate to apply to self not to f.

But that's on a sample of 1 person's intuition :).

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



More information about the Python-list mailing list