[Python-ideas] Decorator syntax restriction

Rob Cliffe rob.cliffe at btinternet.com
Wed Oct 7 11:31:26 CEST 2009


Well, if the syntax was loosened to allow a subscript, i.e.

@a.b.c[x]( ...args... )

that would be something.  And allowing a dictionary ley as well - with the 
same syntax - would be even better; it seems hard to justify allowing one 
without the other.

On the other hand, maybe in future someone will come up with another 
'must-have' loosening of the syntax.  Eventually, don't you get to the point 
where it's simpler to allow anything?

Best wishes
Rob Cliffe


----- Original Message ----- 
From: "Greg Ewing" <greg.ewing at canterbury.ac.nz>
To: <python-ideas at python.org>
Sent: Saturday, October 03, 2009 2:40 AM
Subject: Re: [Python-ideas] Decorator syntax restriction


> Paul Moore wrote:
>
>> @(a['b'].fns[1])(1,2,{3,4})
>> def something():
>>
>> I contend that's clearly "line noise".
>
> But there's nothing to stop you from writing
>
>   f = (a['b'].fns[1])(1,2,{3,4})
>   @f
>   def something():
>
> If the first version is unreadable, the second one isn't going
> to be significantly better.
>
> -- 
> Greg
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas 




More information about the Python-ideas mailing list