[Python-Dev] Re: Call for defense of @decorators (original) (raw)

Guido van Rossum guido at python.org
Mon Aug 9 17:39:45 CEST 2004


that the decorator can fundamentally alter the meaning of the def statement is not at all clear -- and it ought to be! By contrast, those proposed syntaxes which have the decorators in the def statement (somewhere between the def and the colon) do not suffer this opacity.

I think that's too strict a rule. You're asking for something to be intuitively clear from looking at the syntax alone, without having learned it before. All I'm asking for is that it's easy to remember once explained. Very few things beyond 2+2 are intuitively clear, even in Python; almost everything is easy to explain and remember though, and I think that @decorators fall in that category, too.

(And of course, to anyone who's programmed in Java 1.5 before, @decorators will be intuitively clear. But that's not the main motivation.)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list