[Tutor] Looping problem

Lloyd Kvam pythonTutor at venix.com
Thu Aug 12 20:16:10 CEST 2004


On Thu, 2004-08-12 at 14:00, vicki at thepenguin.org wrote:
> > On Thu, 2004-08-12 at 13:21, vicki at thepenguin.org wrote:
> > snipped
> >>                     while not LTRD_END:
> >>                         for byte in readString:
> >
> > I do not see any place in this loop where readString gets advanced.
> > Should result really be readString???
> > Do you need to bind readString to result at the end of the for loop???
> 
> Doesn't the "for readString in infile.readlines():" automatically iterate
> through the lines in the file resetting readString each time?

only if the program breaks back out to advance that loop level. 
readString is within the while not LTRD_END loop.

Perhaps you really want to break on LTRD_END?

I did not really try to understand the code as a whole, I just saw that
you will likely be processing the same readString over and over.

> 
> --Vicki
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-- 

Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-653-8139
fax:	801-459-9582



More information about the Tutor mailing list