Reduce need of backslash

Peter Hansen peter at engcorp.com
Fri Sep 26 16:59:17 CEST 2003


Nicolas Fleury wrote:
> 
> I was wondering if the need for \ could be reduce in the language.  For
> example, could a line ending with = or + could be automaticly considered
> incomplete?

What should Python do in the following case?

   a = 5 +
   someFunc(a)

Okay, you want it to quietly add 5 and the result of someFunc() together and 
assign to "a".  What if I told you that I actually had intended to add 5
plus "b" and assign to a, then call someFunc() and discard the return value.

You've just turned a nice clean error message from the compiler into a 
silent and possibly deadly bug.

"Explicit is better than implicit, and errors should never pass silently"
as has been noted again recently in another thread.

-Peter




More information about the Python-list mailing list