purplezephyr added the comment:
This does not seem to have been changed in any version, per msg135246. If it's
not going to be replaced, there's another issue, which is that the link to
readline() in the text is incorrect - it goes to the readline module, not
file.readline().
--
Terry J. Reedy added the comment:
In the current 3.3.2 docs, 'STOP' has been replaced by '', so there is a
change, and no infinite loop. However, this is still does not strike me as an
example of 'useful' as
for line in iter(fp.readline, STOP): # is a bad version of
for line in fp:
It
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11163
___
Michael Grazebrook mich...@grazebrook.com added the comment:
Thank you.
On 25/06/2011 13:38, Raymond Hettinger wrote:
Changes by Raymond Hettingerraymond.hettin...@gmail.com:
--
resolution: - fixed
status: open - closed
___
Python
Bryce Verdier bryceverd...@gmail.com added the comment:
Here is the patch to fix the documentation. Asked some core developers off the
bug tracker how to handle this bug in relation to the bigger issue regarding
STOP leading to an infinite loop.
--
keywords: +patch
nosy: +louiscipher
Terry J. Reedy tjre...@udel.edu added the comment:
I think this is the wrong patch for reasons given below.
The example should be replaced instead.
Readline is documented as returning '' at EOF for text files.
Iter(func,sentinel) is documented as calling func until sentinel is returned.
If
Changes by Terry J. Reedy tjre...@udel.edu:
--
versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3 -Python 2.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11163
___
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
assignee: docs@python - rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11163
___
Raymond Hettinger raymond.hettin...@gmail.com added the comment:
I'll replace this with a better example using binary chunked reads that
terminate with an empty string.
--
priority: normal - low
___
Python tracker rep...@bugs.python.org
New submission from Michael Grazebrook mich...@grazebrook.com:
This code fragment from the documentation of iter() doesn't work as intended.
Change STOP to STOP\n. Maybe also check for EOF as it hangs.
with open(mydata.txt) as fp:
for line in iter(fp.readline, STOP):
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11163
___
___
Python-bugs-list
11 matches
Mail list logo