On 2011-08-12, Chris Angelico <ros...@gmail.com> wrote: > On Fri, Aug 12, 2011 at 5:33 PM, Seebs <usenet-nos...@seebs.net> wrote: >> I've seen people in C do stuff like:
>> ? ? ? ?for (i = 0; i < N; ++i); >> ? ? ? ? ? ? ? ?a[i] = 0; >> This is clearly a case where indentation matches intent, but doesn't match >> functionality, because C allows indentation to not-match functionality; this >> is the famous problem Python is solving. > There's several solutions to this. One is linting utilities that > detect unexpectedly-indented code, which is the concept that Python > took to the logical extent of syntactic errors. Another is (again > linting) to disallow a direct trailing semicolon; if you want an empty > body, you put whitespace before the semicolon. > > But that wasn't your point, I realise :) I think it sort of is. My current preference would be that C-like languages would simply absolutely eliminate optional-braces. Then the whole category of errors would partially-go-away. You could still have code which didn't do what you meant, but it would be reliably easy to see what it did, and so on. But it's interesting to note that there are many ways to address this. Most of the C I've done has been in circumstances where misindented code was in fact a thing that would fail reviews. -s -- Copyright 2011, all wrongs reversed. Peter Seebach / usenet-nos...@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. -- http://mail.python.org/mailman/listinfo/python-list