[Python-Dev] Plea for simpler decorator syntax, in addition to pie-shaped syntax

Fred L. Drake, Jr. fdrake at acm.org
Wed Aug 4 17:00:34 CEST 2004


On Wednesday 04 August 2004 10:52 am, Jim Fulton wrote:
 > IMO, the most common uses of decorators will be to define properties,
 > and class and static methods.  IMO, these uses would be better served
 > by a simpler syntax:
 >
 >    def classmethod foo(cls, ...):
 >        ...

This was rejected a long time ago because it complicated life for editor 
colorizing support and many similar tools.  It especially complicates the 
creation of ad-hoc tools, and breaks ones that are already working.

While pie-notation isn't my favorite, it's reasonable enough.  The example

    @classmethod
    def makeAnother(cls):
        return cls("magic", 42)

seems readable enough to me.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>



More information about the Python-Dev mailing list