Teaching Programming
Ed Keith
e_d_k at yahoo.com
Tue May 4 10:21:29 EDT 2010
--- On Tue, 5/4/10, alex23 <wuwei23 at gmail.com> wrote:
> From: alex23 <wuwei23 at gmail.com>
> Subject: Re: Teaching Programming
> To: python-list at python.org
> Date: Tuesday, May 4, 2010, 10:06 AM
> Ed Keith <e_... at yahoo.com>
> wrote:
> > For more information on Literate Programming in
> general see the following links.
>
> None of which address the question of what you found
> problematic about
> generating Python code. Was it issues with indentation?
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Yes, the problem was indentation.
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.
and
2) expand all tabls to spaces and allow the user to set the tab
expansion size from the command line. Fortunately Python provides
good support for this.
Neither of these problems exist in languages that are not indention sensitive.
Tabs are always a problem when writing Python. I get around this problem by setting my text editor to expand all tabs with spaces when editing Python, but I have had problems when coworkers have not done this.
Don't get me wrong, I love working in Python. It is one of my favorite languages, but it, like all other languages, is not perfect.
-EdK
Ed Keith
e_d_k at yahoo.com
Blog: edkeith.blogspot.com
More information about the Python-list
mailing list