Python indentation

Antoon Pardon apardon at forel.vub.ac.be
Thu Jul 8 04:11:08 EDT 2004


Op 2004-07-07, Brian Quinlan schreef <brian at sweetapp.com>:
> Sateesh wrote:
>> I surely understand the importance of indentation, but as you see there are
>> beautification tools that can be used to beautiy the C code. 
>
> I'm not sure why this is relevant.
>
>> Also indentation is based upon ones style of coding, and I feel somewhat
>> restricted when the language itself restricts someone to code in a
>> particular way.
>
> Which is why I asked you to name a desirable code construction that 
> Python denies you due to it's indentation rules. If, for example, you 
> find the following style compelling:

Well personnaly if i have a loop with the terminating condition
in the middle I now have to write it like this

while True:
  code
  if condition: break
  code


I would prefer to indent sucu code as follows:

while True:
  code
if condition: break
  code


Why? because the loopbreaker is IME part of the loopstructure,
not an ordinary if statement in the loopbody.

This is why I prefer free form languages. If you need certain
control structure that is not directly in the language but
can be simulated, you can still indent your code according
to the structure you have in mind as opposed to the structure
that is forced upon you by the simulation.

-- 
Antoon pardon



More information about the Python-list mailing list