[Python-Dev] Re: PEP 318: Decorators last before colon

Simon Percivall s.percivall at chello.se
Wed Mar 31 20:30:15 EST 2004


On 2004-04-01, at 01.32, Guido van Rossum wrote:
>>> Why does <...> look better than [...]?  To me, <...> just reminds me
>>> of XML, which is totally the wrong association.
>>
>> I vote for << >>. The brackets and parens have too many meanings in
>> Python already. <<staticmethod, foobar(baz)>> looks more like French
>> than XML. ;)
>
> <<...>> has the same practical problems as <...>: no automatic line
> breaking, >> is ambiguous.

So is automatic line breaking really necessary? Why not just wrap the 
actual decorators inside parentheses if you need to? Like:

<<(long_decorator(attrs={'author':'somebody',
                          'frequency':'daily'}),
    another_decorator,
    one_more_decorator)>>

<(long_decorator(attr={'author':'somebody',
                        'frequency':'daily'}),
    another_decorator,
    one_more_decorator)>

Well ... it's not pretty.

As for the ambiguity: If '[...]' can be handled for that special case, 
can't '<...>' or '<<...>>' also be handled? They would be much less 
ambiguous for the human interpreter.




More information about the Python-Dev mailing list