]> granicus.if.org Git - python/commitdiff
Clarify acceptable values for BZ2File.__init__'s mode argument.
authorNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 4 Jun 2012 21:31:22 +0000 (23:31 +0200)
committerNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 4 Jun 2012 21:31:22 +0000 (23:31 +0200)
Doc/library/bz2.rst
Lib/bz2.py

index de5c825b9c8bc015ea7cd99ea6e3c1785d6e2b82..893bb9ba82587b18a55df7951d6cdd3dae04309a 100644 (file)
@@ -35,9 +35,11 @@ All of the classes in this module may safely be accessed from multiple threads.
    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.
 
index ae59407c1ac2d365619b606debfcae4819758ca6..d04731bfd1a2578881b308422428ac6a703a0564 100644 (file)
@@ -46,8 +46,8 @@ class BZ2File(io.BufferedIOBase):
         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.