Preserving program structure
Javier Bezos
see.below at no.spam.es
Tue Dec 18 05:31:51 EST 2001
David Dawkins <david_j_dawkins at spamless.hotmail.com> wrote:
> So I'm using IDLE, and Alt-F5 tells me I have a problem with
> indentation.
>
> It seems I had (inadvertently) mixed tab and space characters.
> No amount of "tabbifying" and "untabbifying" resolved the issue,
> so I had to shift *everything* to the left-margin, and re-create
> the indentation with a consistent scheme (8 space hard tabs).
>
> While doing so, I stuffed up a lot of the program logic, because
> it wasn't always obvious which block a particular statement
> belonged in. This dismayed me intensely.
>
> How do experienced Python programmers avoid this problem?
> I don't see much code out there with comments like "# endif", etc.
Since I've lost several programs thanks to this "feature" of Python,
I've decided to add thinks like that and I've found that just
"# end" or even "##" at the end of every block is enough to avoid
lots of problems. Yet, I'm not an experienced Python programmer,
but I must confess the more I use Python the more I hate that
(my point of view, of course).
Regards
___________________________________________________________
Javier Bezos | TeX y tipografia
jbezos at wanadoo dot es | http://perso.wanadoo.es/jbezos/
More information about the Python-list
mailing list