[Tutor] Searching in a file

Lie Ryan lie.1296 at gmail.com
Thu Jan 14 15:50:52 CET 2010


On 01/14/10 10:29, Hugo Arts wrote:
> On Thu, Jan 14, 2010 at 12:05 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
>> >
>> > I prefer the next() approach.
> Rightfully so. IMO, The while loop with readline is basically the C
> version of that, for the poor people who don't have iterators.

I would often prefer while loop with next() though. Writing a state
machine with for-loop can become quite messy because of the implicit
next() on each iteration.



More information about the Tutor mailing list