- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | ChrisRands |
|---|---|
| Recipients | ChrisRands, docs@python |
| Date | 2018-09-21.15:41:31 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1537544491.72.0.956365154283.issue34764@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
|---|
This arose from this SO question: https://stackoverflow.com/questions/52446415/line-in-iterfp-readline-rather-than-line-in-fp The example given in the docs: with open('mydata.txt') as fp: for line in iter(fp.readline, ''): process_line(line) Is exactly equivalent to the following because an empty string is only returned by readline at the EOF: with open('mydata.txt') as fp: for line in fp: process_line(line) The empty string '' sentinel value could be changed to another value to provide a possibly more meaningful example where the 2nd code snippet would not always produce the same result? |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-09-21 15:41:31 | ChrisRands | set | recipients: + ChrisRands, docs@python |
| 2018-09-21 15:41:31 | ChrisRands | set | messageid: <1537544491.72.0.956365154283.issue34764@psf.upfronthosting.co.za> |
| 2018-09-21 15:41:31 | ChrisRands | link | issue34764 messages |
| 2018-09-21 15:41:31 | ChrisRands | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
