New to Python - block grouping (spaces)

Antoon Pardon antoon.pardon at rece.vub.ac.be
Thu Apr 16 12:09:44 CEST 2015


On 04/16/2015 11:34 AM, Chris Angelico wrote:
> On Thu, Apr 16, 2015 at 6:47 PM, Antoon Pardon
> <antoon.pardon at rece.vub.ac.be> wrote:
>> On 04/16/2015 09:46 AM, alister wrote:
>>
>>> what I find strange is that although these programmers initially disliked
>>> forced indentation they were voluntarily indenting there existing code
>>> anyway. Take a look at your existing code base & see if this would indeed
>>> be the case.
>> The problem is that the logical structure one has in one's head is not always
>> the same as the physical structure one has to implement in. I prefer the
>> indentation of my program to reflect the former instead of the latter. That
>> is impossible in python.
> I agree, but as it turns out, the number of times when this actually
> makes a difference are diminishingly few. 

I beg to differ. The most common occurence is a loop with a break condition
in the middle I would prefer such a loop to be written as follows:

repeat:
    some
    code
break_when condition:
    more
    code

Actually I would prefer a more elaborate scheme but would be contend with
a possibility like the above. IMO this is the most occuring pattern where
the logical structure doesn't match the physical structure and it is not
occuring relevantly less now.




More information about the Python-list mailing list