Revised PEP 318 - Function/Method Decorator Syntax

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Tue Jun 10 23:57:10 EDT 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
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list