[Tutor] Looping problem

vicki at thepenguin.org vicki at thepenguin.org
Thu Aug 12 20:06:29 CEST 2004


> Vicki,
>
> There is a problem with the loop nesting. The loop "while not LTRD_END:"
> is
> inside the readlines() loop. What happens is the program repeats the while
> not LTRD_END: forever - it gets stuck on the first line. In other words,
> it
> keeps processing the first line over and over. Since this line has no
> <EOT>, the while loop never exits.
>
> One way to fix this might be to put a conditional break at the end of the
> readlines() loop like this:
> if LTRD_END:
>    break
Thanks. I'll try that.
>
> Another thing I noticed is the indentation is very inconsistent. You are
> using a mix of tabs and spaces to indent lines. This is not a good idea in
> Python - you should choose one way to indent. Many people use four spaces,
> but you can use tabs if you want. The important thing is to be consistent.
>
> Kent

Yes, unfortunately every time I paste into my mailer, I have to fix the
spacing, hence the mixture because the mailer recognizes tabs as external
commands to go to the next button, etc. It is not that way originally. I
use the default tabbing in Python.

--vicki



More information about the Tutor mailing list