>> The most compelling reason that I have heard is that, as-is, you
>> cannot reconstruct a properly indented program from an improperly
>> indented one.
Yes. If you match brackets incorrectly by putting them at the wrong
spot you wrote faulty code and no program can fix that for you.
Typically the easiest way to catch it to run it through an indentation
program and catch it visually. In Python, using wrong indentation is
the same as putting brackets where they don't belong, so don't expect a
formatter to fix problems it can't fix. (And you don't even have to run
it through an indentation program to find it!)
Personally, I've never had any problems with Python's indent-oriented
parser and find it much easier to write code in than the atrocious
brackets and other clutter in C (or other languages like C).
When changing existing code, you end up searching for the correct
brackets to add/remove in C, plus you have to run it through a
formatter (if you don't fix the indentation by hand). In Python you
left/right shift the affected code. I don't see a whole lot of
difference in the amount of effort it takes in either language...
>> It is quite a bit easier to fix up the indentation of a C program than
>> it is to fix up the indentation of a Python. Given a good set of
>> "style-rules" and a messed up C program, there is only one way to fix
>> up the indentation. Given Python's current syntax and a messed up
>> Python program, there are many ways to fix it up... and each means
>> somthing different. To properly re-indent a Python program you must
>> read the code and figure out which of the many possible combinations
>> is the right one.
Again, a messed up Python program probably means faulty code. If the
original program is correctly formatted, the cut and paste should
produce correctly formatted code, maybe several levels too far to the
left or to the right. The latter is easily fixed with any reasonable
editor. It should be easy to run something like 'pindent' over the
source to change the number of spaces used per indentation level if
there is a difference in style between the pasted code and your code.
>> Python already has a 'begin' statement... it is written as a colon.
>> The 'begin' is interpreted relative to its position within the code,
>> that is, move the code, the 'begin' moves with it. But the current
>> version of the 'end', the DEDENT token, is an absolute value, and is
>> not relative to its context, move the code and the DEDENT does not
>> know that it was moved. This adds an element of asymmety to the
>> language that I feel should be removed.
The 'pindent' program solves this asymmetry for you (no?).
-- Jaap Vermeulen +--------------------------+ | Sequent Computer Systems | Internet : email@example.com | Beaverton, Oregon | Uucp : ...uunet!sequent!jaap +--------------------------+