decorator J4 - any objections?

Martin DeMello martindemello at yahoo.com
Sat Aug 21 06:37:29 EDT 2004


Jeff Shannon <jeff at ccvcorp.com> wrote:
> 
> In fact, the biggest problem that I can see with the J4 syntax is its 
> close similarity to all of the decorator-inside-def variations.  Since 
> GvR has spoken strongly against putting decorators in that location, it 
> seems to me to be a waste of effort to advocate for that.  Now, perhaps 
> having that outdented keyword to indicate the function-body start 
> *might* make a difference with him...  but I would expect that it won't.

The advantage J4 has over J2 is that "def function <decorators> as
<body>" reads much better than "decorate <decorators> def function
<body>" - expected from English syntax is 'decorate def function <body>
with <decorators>'. 

Perhaps J2 but with proposal L to call the decorator declaration
something other than "decorate" - 'using' is the best I've seen so far,
though it's still not perfect. Or another idea - how about inverting the
meaning of 'as', and changing the form of the decorator declarations
slightly? 

as:
  classmethod
  memoised
  accepting (int, int)
  returning (float)
def foo(bar, baz):
  .
  .
  .

martin
  
  

martin



More information about the Python-list mailing list