Compare source code

Seebs usenet-nospam at seebs.net
Wed Nov 3 16:39:47 EDT 2010


On 2010-11-03, Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
> 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'd guess I see something which got screwed up somehow every couple of
weeks, usually while refactoring stuff.

>> 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.

True, but it doesn't seem to catch the most common failure modes.

> 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.

This is ridiculous overstatement.  Moving a single block of overly-nested
code out into a separate method could generate several indentation
mishaps if Something Goes Wrong, which it does sometimes.  I haven't
written more than a couple hundred blocks in Python, so I'm a factor of a
hundred out from twenty thousand braces, and I've had six or seven
indentation problems.

And yes, I can just recreate it, but it takes more effort, since I can't
do things like just handing it to an automated tool that can correct
it completely automatically.

Furthermore, I don't WANT to skip closing braces.  EXPLICIT IS BETTER
THAN IMPLICIT.  I *WANT* to have the beginnings and ends marked.

I want end braces or "end" or something at the end of a block for
the same reason that I prefer:
	x = "hello, world"
to
	x = "hello, world
where we just assume the string ends at the end of the line.

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

> So you say.

Well, it works for me.

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list