decorators as a special case of an @ operator?

Peter Hansen peter at engcorp.com
Mon Aug 9 13:58:37 EDT 2004


Dan Christensen wrote:
> Is there any reason that python doesn't automatically
> continue all incomplete binary operators, allowing
> 
>    x = a_very_long_expression +
>        another_long_expression
> ?

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?

x = a_very_long_expression + some_more
some_function_that_might_return_a_value()

If this is what the programmer intended, the implicit
approach could be disastrous.

-Peter



More information about the Python-list mailing list