Revised PEP 318 - Function/Method Decorator Syntax

Greg Ewing (using g2h5dqi002 at
Wed Jun 11 05:57:10 CEST 2003

Erik Max Francis wrote:
> Chris Liechti wrote:
>>  def foo(self) [synchronized(lock), classmethod]:
> To me it says, "Hi, I'm a list!" when listness does not seem warranted. 

To me, the [] are parentheses used as one might use
parentheses to enclose an annotation in English, and
the resemblance to a list constructor is coincidental.

>>  def foo(self) as [synchronized(lock), classmethod]:
> Doubling up the syntaxes seems unnecessary.

It also destroys the parenthetical-comment interpretation.
If both were really wanted, it would have to be

   def foo(self) [as synchronized(lock), classmethod]:

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list