Teaching Programming

Ed Keith e_d_k at yahoo.com
Tue May 4 11:11:20 EDT 2010


--- On Tue, 5/4/10, James Mills <prologic at shortcircuit.net.au> wrote:

> From: James Mills <prologic at shortcircuit.net.au>
> Subject: Re: Teaching Programming
> To: "python list" <python-list at python.org>
> Date: Tuesday, May 4, 2010, 10:35 AM
> 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.
> 
> --James
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Not in this case, because the user is required to include all text of the program in the chunks, the tools does not generate any text, It only needs to generate white space if the language is white space sensitive. 

I can see how it could be a problem in other cases.

In the interest of completeness, I should mention that I had to take care not to introduce extraneous line breaks for languages that are sensitive to them. It is much easier to generate code for languages that are completely white space agnostic. 

I actually find the fact that I need to think about where I can, and where I can not, break a line to be a bigger problem when write code, than keeping track of indentation level. And Python is not the only language that has this problem.

    -EdK

Ed Keith
e_d_k at yahoo.com

Blog: edkeith.blogspot.com




      



More information about the Python-list mailing list