[Python-Dev] Density of pie-decorator syntax (original) (raw)

Dmitry Vasiliev lists at hlabs.spb.ru
Mon Aug 9 12:20:32 CEST 2004


Josh Hoyt wrote:

One problem I have with the pie-decorator syntax is that it is very typographically dense. The @ character runs in with the following function name. If there are multiple lines of decorators, the problem is worsened. For clarity, the decorators will have no whitespace lines between them, creating a dense block.

After experimenting, I have found that readability is increased if there is one space required after the @. Don't take my word for it: Current Python 2.4a2 syntax: @frameworkstuff(lots, of, args) class Quux(object): @checkargs(int, str) @counted @staticmethod def frobnicate(foo, bar): pass Proposed change requiring a space: @ frameworkstuff(lots of args) class Quux(object): @ checkargs(int, str) @ counted @ staticmethod def frobnicate(foo, bar): pass

"@ decorator" working just fine with Python 2.4.a2. Try this... :-)

-- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru



More information about the Python-Dev mailing list