homepage

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.

classification
Title: Optional size argument for readline()
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: deleted250130, pitrou
Priority: normal Keywords:

Created on 2012年07月25日 20:15 by deleted250130, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (2)
msg166422 - (view) Author: (deleted250130) Date: 2012年07月25日 20:15
For file objects the read() function has the optional size argument to limit the data that will be read. I'm wondering why there isn't such an argument for readline(). Theoretically lines in a file could have million of characters and even much more. An optional limit could prevent that a high amount of data will be load into the memory.
msg166424 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年07月25日 20:35
Well, it does:
http://docs.python.org/dev/library/io.html#io.IOBase.readline
"readline(limit=-1)
 Read and return one line from the stream. If limit is specified, at most limit bytes will be read."
History
Date User Action Args
2022年04月11日 14:57:33adminsetgithub: 59654
2012年07月25日 20:35:31pitrousetstatus: open -> closed
resolution: works for me
2012年07月25日 20:35:15pitrousetnosy: + pitrou
messages: + msg166424
2012年07月25日 20:15:47deleted250130create

AltStyle によって変換されたページ (->オリジナル) /