Teaching Programming

Ethan Furman ethan at stoneleaf.us
Tue May 4 11:28:08 EDT 2010


Andre Engels wrote:
> On Tue, May 4, 2010 at 4:35 PM, James Mills
> <prologic at shortcircuit.net.au> wrote:
>> On Wed, May 5, 2010 at 12:21 AM, Ed Keith <e_d_k at yahoo.com> wrote:
>>> To deal with indentation I had to
>>>
>>>   1) keep track of indentation of all chunks of code embedded in the
>>>      document and indent inserted chunks to the sum of all the
>>>      indentation of the enclosing chunks.
>> In my experience of non-indentation sensitive languages
>> such as C-class (curly braces) it's just as hard to keep track
>> of opening and closing braces.
> 
> Although I have little or no experience with this, I still dare to say
> that I don't agree. The difference is that in C you do not _need_ to
> know where in the braces-defined hierarchy you are. You just embed or
> change a piece of code at the right location. In Python however you
> _do_ need to know how far your code is to be indented.

And how do you know where the right location is?  You have to figure it 
out from the different (nested) braces at the 'right' location.  For me, 
at least, it's much easier to get that information from the already 
indented Python code, as opposed to indenting (and double-checking the 
indents) on the braces language.

~Ethan~



More information about the Python-list mailing list