Op 29-08-13 09:50, Gary Herron schreef: > On 08/28/2013 07:10 PM, Sam Fourman Jr. wrote: >> >> On Wed, Aug 28, 2013 at 8:18 PM, Mohsen Pahlevanzadeh >> <moh...@pahlevanzadeh.org <mailto:moh...@pahlevanzadeh.org>> wrote: >> >> Dear all, >> >> I'm C++ programmer and unfortunately put semicolon at end of my >> statements in python. >> >> Quesion: >> What's really defferences between putting semicolon and don't put? >> >> Yours, >> Mohsen >> >> >> I totally understand where you are coming from, but >> I have found that the thing I can't get used to is the "indent thing" >> >> Python is a great language, but I always secretly find myself >> wishing I could somehow use python, and not deal with the mandatory >> "indents" >> >> >> Sam Fourman Jr. >> > > What an odd thing to say. In what sense do you consider indents to be > non-mandatory in other languages? In *any* programming language, if you > write code without indents, it is absolutely unreadable, absolutely > unmaintainable, and you will be absolutely fired!
Sure but the most readable indentation is not always the indentation that follows the formal structure. Also IIRC it stopped the introduction of a number of language features because the feature didn't seem to fit pythons obligated indentation. Without the forced indentation, one could introduce the feature and have people experiment with what kind of indentation works best. Now that wasn't an option. > Other languages force you (and your editor) to maintain two indications > of nesting, (1) indentation, so you can read it, and (2) > braces/begin/end/whatever, so the compiler can read it. Neither one is > truly optional, and woe to you if the two don't match. On the other > hand, Python's use of indentation as the (only) indication of nesting is > readable by both humans and parsers. Sure but it means you lose redundancy and so sometimes that means it is harder to find the problem. I remember the time that I somehow ended up copying part of a function lower in the file. Now because there was no need of a right brace or end or whatever this file executed without a problem but redefined the function into an incomple one. Should some kind of end marker be needed, the problem would have been found much easier, because if would have produced a syntax error. > Looked at that way, other languages seem foolish and burdensome and > Python's indentation is the only sensible way. I don't agree. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list