New to Python - block grouping (spaces)
rosuav at gmail.com
Thu Apr 16 11:34:04 CEST 2015
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. The most warpedly correct
indentation I've ever done was in PHP, where I used a triply-nested
structure of switch/case blocks to simulate a logical structure that
in Python would simply be a series of top-level functions - or *maybe*
a series of class definitions with methods in them. So if I were doing
the same logical structure in Python, I wouldn't mind the indentation
matching the physical structure, because it'd be sufficiently close.
More information about the Python-list