Compare source code
usenet-nospam at seebs.net
Wed Nov 3 21:35:20 CET 2010
On 2010-11-03, Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
> On Wed, 03 Nov 2010 02:40:11 +0000, Seebs wrote:
>> Sure, but there's also no way for you to spot that something looks
>> suspicious. In Python, if something is misindented, it does what you
>> told it to do, and there's no way for you to tell, by looking at it,
>> that it isn't what was intended. In C, if something is misindented, it
>> does what you told it to do, but it's obvious looking at the code that
>> something went wrong.
> If it's that obvious, why do people keep causing those indentation-
> related bugs in C?
I don't think they do. I can't remember the last time I've seen one.
> I'm glad for you that you have a finely trained attention to detail that
> is able to instantly spot misindented C code (or is that misplaced braces
> and correctly indented?), but it is a notoriously common error which
> suggests that it's not anywhere near as obvious as you think.
It's "notoriously common", but can you show me an actual example of
it happening in real code? Not a "hey guys look how misleading this
would be" example conjured up for illustration, but an *actual* example
in live code?
I can't remember one, except I think maybe I saw one somewhere in...
hmm. No, wait, that was perl.
>> This level of dogmatism about what should always be the case is not
>> conducive to good software engineering practices.
> I question that assertion. Good engineering practices is about setting
> best practices, and following them, not avoiding them because there might
> be the odd exception here and there.
I don't think I buy this. I've seen a whole lot of good writers and good
programmers, and in both groups, they consistently report that you have
to know how the rules work before you break them.
> The language shouldn't make
> everyone carry the burden of supporting two-page functions all the time,
> just to save you an insignificant amount of trouble on the vanishingly
> rare occasion you need a function that is two pages long.
I don't think there's a particularly big burden there.
Explicit is better than implicit. It is *better* to explicitly mark the
ends of things than to have it be implicit in dropping indentation. That's
not a burden, it's good engineering practice.
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