python-dev Summary for 2004-08-01 through 2004-08-15

Colin J. Williams cjw at sympatico.ca
Wed Aug 25 14:11:21 CEST 2004


Paul McGuire wrote:
> "Brett Cannon" <bac at OCF.Berkeley.EDU> wrote in message
> news:mailman.2274.1093330945.5135.python-list at python.org...
> 
[snip]
> "Well, then allow me to retort."
> 
> Up until PyCon in June, Guido was publicly leaning toward a C1-flavor of
> decorator syntax.  Apparently, there was sufficient furor by some audience
> members (not to quibble whether or not this group was in fact representative
> of all Python users) that Guido dropped back from it.  Sometime in June,
> @decorator seemed to drop from the sky - it was not even one of the top 2
> that GvR had in his keynote presentation - and by late July, it was suddenly
> to be found in the newly released 2.4a2.
> 
My feeling is that Guido was right the first time.  One of C1 or C2 is 
the better way to go.

Why? There is a natural hierarchy.  We do not define methods before the 
class signature is given. A subclass is defined after the class. A break 
is specified within the flow control being broken. We don't refer to a 
function until after is is declared.

In the case of a 'decorator', it is better to identify the thing being 
modified, annotated or whatever before specifying the modification, 
annotation etc.  The exception to this would arise if the 'decoration' 
were to apply to a group of functions or methods, but this is not being 
proposed.

Brett Cameron and Anthony Baxter have pointed out that PEP 318 has been 
on the table for a while.  That's true, perhaps I didn't read it 
carefully enough, but my initial impression was that the PEP was 
concerned with tarting up a function.

It wasn't until I saw Dan Bishop's memoize that I realized the full 
import.  I tried it with his Fibonacci example and found that it offered 
a significant speed improvement over both recursion and the iterative 
solution.

Like many others, I fund the intrusion of a Perlish symbol into Python 
to be surprising.

Thus, to sum up, Guido was right, C1 or C2 would be better than what has 
been implemented in either the current alpha version or Robert Brewer's 
proposal.

Colin W.




More information about the Python-list mailing list