Iterators
Kelson Folkvard Braaten ZAWACK
zawackkfb at gis.a-star.edu.sg
Fri Oct 16 05:24:53 EDT 2009
Recently I was iterating through both a list and a file and I noticed a
difference in behavior. When I create an iterator for a list by calling
iter(list_name) and then call the iterators next method I get the first
element in the list. When I then create another iterator over the same
list and call that iterators next method I again get the first element
of the list, as I expected. When I create 2 iterators on a file in the
manner described above that second iterator returns the second line of
the file. This seems inconsistent. Am I doing something wrong? Is
there a reason for this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091016/8a448b49/attachment.html>
More information about the Python-list
mailing list