allow line break at operators

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Aug 11 21:40:00 EDT 2011


Chris Angelico wrote:

> Incidentally, I will happily argue the
> benefits of Python's significant whitespace, even though I disagree
> with it; there are quite a few. 

Please be careful about conflating significant indentation with significant
whitespace. Many languages have significant whitespace:

foo bar

is rarely the same thing as

foobar

but is the same as

foo           bar

Python is no different.

The only exception I can think of is *very* early Fortran, and that rightly
is considered a mistake. Fortran 77 used to treat whitespace as always
optional, so that in Python terms this:

forxinrange(42)

would be parsed as this:

for x in range(42)


See also:
http://weblog.hotales.org/cgi-bin/weblog/nb.cgi/view/python/2005/02/19/1
http://c2.com/cgi/wiki?SyntacticallySignificantWhitespaceConsideredHarmful


> (Is the fact that it discourages 
> massive one-liners considered to be a benefit?)

Hell yes!


-- 
Steven




More information about the Python-list mailing list