Compare source code

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Nov 3 16:05:58 EDT 2010


On Wed, 03 Nov 2010 01:25:56 +0000, Seebs wrote:

> Whitespace damage is, indeed, wrong.  It's a bad thing.  It is an
> *extremely common* bad thing, 

I question that.

You've claimed that you have to deal with broken indentation on a regular 
basis. I've *never* had to deal with broken whitespace, except for 
certain websites that mangle leading whitespace when you post a comment. 
So I don't post code on those websites.


> and I fundamentally don't think it was a
> good choice to build a system with no redundancy against it.

Python does have some redundancy against indentation mangling. Not all 
combinations of indentation are legal.

# Not legal:
y = x + 1
    z = x*y

# Not legal:
if x:
do_something()

# Not legal:
    if x: do something()
    else:
do_something_else()


And so on. True, there are some failure modes which can't be easily 
recovered from without reading and understanding the code. That's okay. 
Such failure modes are vanishingly rare -- for every twenty thousand 
braces you avoid typing, you might, if you're unlucky, need to fix an 
instance of broken indentation.


> That
> "redundant" information saves our hides on a regular basis in an
> imperfect world.


So you say.


-- 
Steven



More information about the Python-list mailing list