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 martin.panter
Recipients benjamin.peterson, conf, martin.panter, ncoghlan, pitrou, trott
Date 2015-01-09.12:59:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420808360.88.0.328105758204.issue5811@psf.upfronthosting.co.za>
In-reply-to
Content
Is the current documentation as accurate as it can be?

“The number of bytes returned may be less or more than requested”

To me this has always made this method practically useless. A valid implementation could just always return b"". I noticed the BZ2File.peek() documentation (BZ2File is apparently trying to imitate BufferedReader) is slightly more useful:

“At least one byte of data will be returned (unless at EOF)”

That could be used for (say) peeking for a LF following a CR. But still the “size” parameter does not seem very useful. In fact, LZMAFile.peek() says the size is ignored.
History
Date User Action Args
2015-01-09 12:59:20martin.pantersetrecipients: + martin.panter, ncoghlan, pitrou, benjamin.peterson, trott, conf
2015-01-09 12:59:20martin.pantersetmessageid: <1420808360.88.0.328105758204.issue5811@psf.upfronthosting.co.za>
2015-01-09 12:59:20martin.panterlinkissue5811 messages
2015-01-09 12:59:20martin.pantercreate