Seebs wrote: > I have seen all the counterarguments, and what I've > mostly become convinced of is this: > > 1. Indentation as flow control was a bad idea.
I'm not aware of any language where indentation is used for flow control. Python is not one of those languages: it uses for, while, if, etc. for flow control, just like most other languages. It does however use indentation for grouping code into blocks -- a different concept. > 2. People are subconsciously aware of this. > 3. There is a HUGE degree of emotional investment in defending it. > > The responses I have seen on this issue are highly emotional, full of > insults, full of blame-throwing, and utterly contrary to the basic > engineering spirit So you say. You are free to hold whatever opinions you like, but have you considered that the reason people get emotional and angry when others insist that indentation as flow control should be discarded is because they actually believe that the "off-side rule" (as it is called) makes for a better language and a better coding experience? We're not defensive because we subconsciously know you're right, we're defensive because we consciously know you're wrong, have heard all the arguments a thousand times before, and are sick and tired of them. There are dozens, hundreds of brace languages, and 1-2 dozen using indentation, including Python. If braces are so important to you, go use one of those other languages, don't wreck the language we like by taking away one of the best features of the language. > I usually see in programming communities. In other languages, and even in > Python on any issue but this one, I regularly see people acknowledge > shortcomings and explain either why they think the tradeoffs are good, or > why they are willing to put up with it anyway. We're fully aware of the tradeoffs of significant indentation. We believe that brace languages get the trade-offs backwards: they optimise code for environments which mangle source code. 99.999% of code will never pass through a broken mail server that strips leading whitespace, or pasted into broken web forum software that mangles indentation, or go through any other broken tool that messes with indentation. Brace languages optimise for the 0.001% case, Python optimised the 99.999% case. Because people simply don't like it when their code's indentation doesn't match the actual semantics, people usually manually ensure that the two match, braces or no braces. Editors still have commands to indent and outdent blocks of code. There is no difference between (say) C or Pascal and Python in that regard. > * Braces win because they are explicit rather than implicit. There is nothing implicit about indentation. This false dichotomy between so-called explicit braces and allegedly implicit indentation gets thrown around all the time, but it is simply *wrong*. Indentation is not implicit. You (or your editor) has to add whitespace to the line, the parser has to see the whitespace, and an INDENT token is created for it. [...] > In the real world, we are confronted constantly with tools which work > perfectly with every programming language but Python or very old FORTRAN, And ABC, Boo, BuddyScript, Cobra, CoffeeScript, Curry, F#, Genie, HAML, Haskell, ISWIM, Miranda, Nemerle, Occam, PROMAL, Spin and XL, plus any other languages with significant indentation. > but which mangle Python code sporadically and inexplicably. Mail servers > chew up whitespace like there's no tomorrow. Web pages find innovative > new explanations for why those leading spaces don't need to be displayed. No, most mail servers don't mangle whitespace in the body of the email, or in attachments. Some mail clients do, usually because they default to using HTML for text. So get a better mail client. Avoid pig-ignorant web forums that think that source code can be reflowed or that remove leading whitespace. Stop using Notepad, and use an editor that offers indent and outdent commands. If your mail server had a bug that deleted braces from emails, would you fix the bug, or would you insist that braces were a failed experiment and that C should stop using { } and start using BEGIN END like Pascal? -- Steven -- http://mail.python.org/mailman/listinfo/python-list