elements of decorator syntax suggestions

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Sun Aug 8 12:08:25 CEST 2004


Anthony Baxter wrote:
>> @ sure takes up more visual space and is easier to spot in text than |,
>> which is precisely why I used it in EmPy as the token prefix (also
>> because @ at the time is neither commonly used in English text or legal
>> in Python, though the latter will be changing).
> 
> The far-more-obvious-in-code is my reason for preferring @ over |. 

In that respect I think '=' would be pretty good too.
And possibly '!'.

However,

    if (long-expression
        | more-expresson):
        |decorator-function(blah blah)
        def foo(): pass

Could do the same with != and '==', but at least that's different from
'!' and '='.  One could write

    if bar(long_variable_name
           =value):
        =decorator-function(blah blah)
        def foo(): pass

though that seems a bit contrived.

-- 
Hallvard



More information about the Python-list mailing list