[Python-Dev] Re: Decorators after 'def' should be reconsidered

Skip Montanaro skip at pobox.com
Thu Aug 12 21:14:35 CEST 2004


    Laurence> I must say I like this idea a lot. It seems much more in
    Laurence> keeping with the rest of the python block structure. You could
    Laurence> even think of decorators as bullet points. Now if only someone
    Laurence> hadn't already found a use for '*' character...

I think '*' is syntactically available for this use.  It's not used as a
unary operator I don't believe.  The *args thing isn't available in the
context where decorators would be used.

That also has the nice side effect of turning @ back over to tools like leo
and ipython.  Unlike '|' it's not likely to be mistaken for other commonly
used characters.  Also, a unary '*' or '**' already have some special
meaning when used in and around function definitions, so seeing

    *deco
    def func(...):
        ...

or

    def func(...):
        *deco
        ...

might be a small hint to readers of the code that deco is somehow involved
in the function's definition.

Skip


More information about the Python-Dev mailing list