[Python-checkins] cpython: Clarify acceptable values for BZ2File.__init__'s mode argument.

nadeem.vawda python-checkins at python.org
Mon Jun 4 23:55:53 CEST 2012


http://hg.python.org/cpython/rev/3235748e6e81
changeset:   77354:3235748e6e81
user:        Nadeem Vawda <nadeem.vawda at gmail.com>
date:        Mon Jun 04 23:31:22 2012 +0200
summary:
  Clarify acceptable values for BZ2File.__init__'s mode argument.

files:
  Doc/library/bz2.rst |  8 +++++---
  Lib/bz2.py          |  4 ++--
  2 files changed, 7 insertions(+), 5 deletions(-)


diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -35,9 +35,11 @@
    be used to read or write the compressed data.
 
    The *mode* argument can be either ``'r'`` for reading (default), ``'w'`` for
-   overwriting, or ``'a'`` for appending. If *filename* is a file object (rather
-   than an actual file name), a mode of ``'w'`` does not truncate the file, and
-   is instead equivalent to ``'a'``.
+   overwriting, or ``'a'`` for appending. These can equivalently be given as
+   ``'rb'``, ``'wb'``, and ``'ab'`` respectively.
+
+   If *filename* is a file object (rather than an actual file name), a mode of
+   ``'w'`` does not truncate the file, and is instead equivalent to ``'a'``.
 
    The *buffering* argument is ignored. Its use is deprecated.
 
diff --git a/Lib/bz2.py b/Lib/bz2.py
--- a/Lib/bz2.py
+++ b/Lib/bz2.py
@@ -46,8 +46,8 @@
         be opened. Otherwise, it should be a file object, which will be used to
         read or write the compressed data.
 
-        mode can be 'r' for reading (default), 'w' for (over)writing, or
-        'a' for appending.
+        mode can be 'r' for reading (default), 'w' for (over)writing, or 'a' for
+        appending. These can equivalently be given as 'rb', 'wb', and 'ab'.
 
         buffering is ignored. Its use is deprecated.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list