Grouping code by indentation - feature or ******?

Antoon Pardon apardon at forel.vub.ac.be
Tue Mar 29 02:57:33 EST 2005


Op 2005-03-25, Terry Reedy schreef <tjreedy at udel.edu>:
>
> "Antoon Pardon" <apardon at forel.vub.ac.be> wrote in message
>
>> 1) It makes it hard to see how many levels are dedented at the end of
>>   a suite, and sometime makes it difficult to see where the end
>>   of a suite is. If e.g. you are looking at the code spread over
>>   two pieces of paper, it is sometimes hard to see whether the
>>   suite ends at the end of the first page or not.
>
> One can use appropriately indented comment lines instead of closing 
> brackets for this purpose.

But then we are back at the problem of different styles.

People argue they like the python rule, because they have
difficulties with the different styles that are allowed
by the free form that is allowed in othe languages.

>> 2) It makes it hard to introduce some kind of new syntax constructs.
>
> I consider this as much a plus as a minus ;-)

I can see your point. We don't want an avalance of new constructs
and some restraint is needed but I feel python is too restraint
here.

>> 3) Sometimes the structure of the algorithm is not the structure
>>   of the code as written, people who prefer that the indentation
>>   reflects the structure of the algorithm instead of the structure
>>   of the code, are forced to indent wrongly.
>
> Do you have any simple examples in mind?

Essentially each time I need to use:

  if condition break.

IMO this part of the code is usualy a control for a loop and thus
of the same level as

  while condition:

-- 
Antoon Pardon



More information about the Python-list mailing list