[Python-Dev] Vote No on 318

Shane Hathaway shane at zope.com
Thu Apr 1 19:24:18 EST 2004


Raymond Hettinger wrote:
> A failing common to all of the proposals is that they turn action words
> (like classmethod) into adjectives with implicit actions.  By making
> them implicit, it becomes less obvious what is occurring, when it is
> occurring, and, for multiple decorators, which order they occur.  That
> will make the wrapped functions harder to debug.

"foo = classmethod(foo)" also uses a noun as a verb.  We're no worse 
than before.  I agree that the meaning of 'y' in "def foo(x) [y]" is not 
obvious, but it is easy to explain: "Python creates function foo, which 
accepts one parameter named x, then applies the y decorator to the 
function."

> A second failing is introducing a second way to do it.  The current
> approach will always be there for some purposes, properties,
> metaclasses, existing code, or dynamic wrapping.  This is a prime
> example where two ways to do something is especially bad; if you do not
> see [staticmethod] in the definition, can you presume that it is not a
> staticmethod -- the answer is clearly no.   So, why create optical
> illusions.

In all places I've seen it used, the current approach sacrifices a lot 
of clarity.  Python should advise against the current approach.

> A third failing is clashing with a design preference for
> functions/expressions over statements/keywords/syntax.  This concept was
> at the foundation for discussions about having a print() function, using
> sorted() in an expression, or implementing if-then-else expressions.  My
> understanding of language design history is that of regrets for not
> using functions wherever possible.

That's an excellent pattern, but Python is much clearer than Lisp 
because it does not try to take that pattern to its ultimate extreme.

> Also, some proposed uses were strange enough that I wonder whether the
> syntax encourages people to do weird things with their code.

The code many of are working with is already weird, and we're grasping 
for some way to clean it up.

Shane



More information about the Python-Dev mailing list