Revised PEP 318 - Function/Method Decorator Syntax

Michele Simionato mis6 at pitt.edu
Fri Jun 13 08:19:01 EDT 2003


"Greg Ewing (using news.cis.dfn.de)" <g2h5dqi002 at sneakemail.com> wrote in message news:<bcbc8b$hf4ub$3 at ID-169208.news.dfncis.de>...
> Steven Taschuk wrote:
> > Quoth Michele Simionato:
>  >
> > > class C[Traced,Protected]: pass
> > 
> > I'd be against such a syntax, fwiw.  Too easy to mistake for the
> > normal subclass syntax.
> 
> Maybe it would help if the base class parentheses
> were required in that case:
> 
>    class C()[Traced,Protected]:
> 
> although I think I would tend to write it with
> a space between:
> 
>    class C() [Traced,Protected]:

It was a typo: I meant

class C(object)[Traced,Protected]: pass

(in my mind the new syntax should only work for new style classes).
I am not a strong supporter of the square bracket syntax, BTW. I
would accept other alternatives, such as

class C(object) is Traced,Protected # but "is" is already used

or even better 

class C(object) becomes Traced,Protected # requires a new keyword

Anyway, to me the precise syntax is somewhat a minor point; I don't
like "as" but all the rest would work.


                     Michele




More information about the Python-list mailing list