Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
98172296
Commit
98172296
authored
Sep 16, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #17003: Unified the size argument names in the io module with common
practice.
parent
a3a5e6d3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
107 deletions
+113
-107
Doc/library/io.rst
Doc/library/io.rst
+26
-26
Lib/_pyio.py
Lib/_pyio.py
+81
-81
Misc/NEWS
Misc/NEWS
+6
-0
No files found.
Doc/library/io.rst
View file @
98172296
...
...
@@ -283,10 +283,10 @@ I/O Base Classes
Return ``True`` if the stream can be read from. If False, :meth:`read`
will raise :exc:`OSError`.
.. method:: readline(
limit
=-1)
.. method:: readline(
size
=-1)
Read and return one line from the stream. If *
limit
* is specified, at
most *
limit
* bytes will be read.
Read and return one line from the stream. If *
size
* is specified, at
most *
size
* bytes will be read.
The line terminator is always ``b'\n'`` for binary files; for text files,
the *newlines* argument to :func:`open` can be used to select the line
...
...
@@ -366,14 +366,14 @@ I/O Base Classes
In addition to the attributes and methods from :class:`IOBase`,
:class:`RawIOBase` provides the following methods:
.. method:: read(
n
=-1)
.. method:: read(
size
=-1)
Read up to *
n
* bytes from the object and return them. As a convenience,
if *
n
* is unspecified or -1, :meth:`readall` is called. Otherwise,
only one system call is ever made. Fewer than *
n
* bytes may be
returned if the operating system call returns fewer than *
n
* bytes.
Read up to *
size
* bytes from the object and return them. As a convenience,
if *
size
* is unspecified or -1, :meth:`readall` is called. Otherwise,
only one system call is ever made. Fewer than *
size
* bytes may be
returned if the operating system call returns fewer than *
size
* bytes.
If 0 bytes are returned, and *
n
* was not 0, this indicates end of file.
If 0 bytes are returned, and *
size
* was not 0, this indicates end of file.
If the object is in non-blocking mode and no bytes are available,
``None`` is returned.
...
...
@@ -442,10 +442,10 @@ I/O Base Classes
.. versionadded:: 3.1
.. method:: read(
n
=-1)
.. method:: read(
size
=-1)
Read and return up to *
n* bytes. If the argument is omitted, ``None``, or
negative, data is read and returned until EOF is reached. An empty
Read and return up to *
size* bytes. If the argument is omitted, ``None``,
or
negative, data is read and returned until EOF is reached. An empty
:class:`bytes` object is returned if the stream is already at EOF.
If the argument is positive, and the underlying raw stream is not
...
...
@@ -457,9 +457,9 @@ I/O Base Classes
A :exc:`BlockingIOError` is raised if the underlying raw stream is in
non blocking-mode, and has no data available at the moment.
.. method:: read1(
n
=-1)
.. method:: read1(
size
=-1)
Read and return up to *
n
* bytes, with at most one call to the underlying
Read and return up to *
size
* bytes, with at most one call to the underlying
raw stream's :meth:`~RawIOBase.read` method. This can be useful if you
are implementing your own buffering on top of a :class:`BufferedIOBase`
object.
...
...
@@ -606,21 +606,21 @@ than raw I/O does.
:class:`BufferedReader` provides or overrides these methods in addition to
those from :class:`BufferedIOBase` and :class:`IOBase`:
.. method:: peek([
n
])
.. method:: peek([
size
])
Return bytes from the stream without advancing the position. At most one
single read on the raw stream is done to satisfy the call. The number of
bytes returned may be less or more than requested.
.. method:: read([
n
])
.. method:: read([
size
])
Read and return *
n* bytes, or if *n* is not given or negative, until EOF
or if the read call would block in non-blocking mode.
Read and return *
size* bytes, or if *size* is not given or negative, until
EOF
or if the read call would block in non-blocking mode.
.. method:: read1(
n
)
.. method:: read1(
size
)
Read and return up to *
n* bytes with only one call on the raw stream. If
at least one byte is buffered, only buffered bytes are returned.
Read and return up to *
size* bytes with only one call on the raw stream.
If
at least one byte is buffered, only buffered bytes are returned.
Otherwise, one raw stream read call is made.
...
...
@@ -739,17 +739,17 @@ Text I/O
.. versionadded:: 3.1
.. method:: read(
n
)
.. method:: read(
size
)
Read and return at most *
n
* characters from the stream as a single
:class:`str`. If *
n
* is negative or ``None``, reads until EOF.
Read and return at most *
size
* characters from the stream as a single
:class:`str`. If *
size
* is negative or ``None``, reads until EOF.
.. method:: readline(
limit
=-1)
.. method:: readline(
size
=-1)
Read until newline or EOF and return a single ``str``. If the stream is
already at EOF, an empty string is returned.
If *
limit* is specified, at most *limit
* characters will be read.
If *
size* is specified, at most *size
* characters will be read.
.. method:: seek(offset, whence=SEEK_SET)
...
...
Lib/_pyio.py
View file @
98172296
This diff is collapsed.
Click to expand it.
Misc/NEWS
View file @
98172296
...
...
@@ -49,6 +49,12 @@ IDLE
- Issue #18988: The "Tab" key now works when a word is already autocompleted.
Documentation
-------------
- Issue #17003: Unified the size argument names in the io module with common
practice.
What'
s
New
in
Python
3.4.0
Alpha
2
?
===================================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment