decorators as a special case of an @ operator?

Peter Hansen peter at engcorp.com
Mon Aug 9 19:39:27 EDT 2004


Dan Christensen wrote:

> Peter Hansen <peter at engcorp.com> writes:
>>Very likely, as is usual with Python, to avoid implicitly
>>assuming something that could well be wrong, thus failing
>>in a possibly very hard to find way, without warning.
>>
>>x = a_very_long_expression +
>>some_function_that_might_return_a_value()
>>
>>Now, was the first line a typo, with a missing extra value,
>>or was it really intended to add the result of the function
>>call on the second line?
> 
> Good point.  What if python did automatic continuation in this
> situation only if the second line was further indented?

I like. :-)  Don't know if it's been considered, but given
that it requires two distinct mistakes on the part of the
programmer, one after the other, it would be hard to argue
that it would happen often.  The indentation part fits nicely
with Python in general.

By the way, you do know that instead of a backslash, lots
of us use parentheses around multi-line expressions?  It
works fine, doesn't seem as ugly as \.

-Peter



More information about the Python-list mailing list