[Python-checkins] cpython: Prefer lzma.open() over lzma.LZMAFile() in lzma module documentation.

nadeem.vawda python-checkins at python.org
Sun Sep 23 18:21:44 CEST 2012


http://hg.python.org/cpython/rev/d81b9e46c06b
changeset:   79106:d81b9e46c06b
user:        Nadeem Vawda <nadeem.vawda at gmail.com>
date:        Sun Sep 23 18:20:23 2012 +0200
summary:
  Prefer lzma.open() over lzma.LZMAFile() in lzma module documentation.

files:
  Doc/library/lzma.rst |  8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst
--- a/Doc/library/lzma.rst
+++ b/Doc/library/lzma.rst
@@ -335,14 +335,14 @@
 Reading in a compressed file::
 
    import lzma
-   with lzma.LZMAFile("file.xz") as f:
+   with lzma.open("file.xz") as f:
        file_content = f.read()
 
 Creating a compressed file::
 
    import lzma
    data = b"Insert Data Here"
-   with lzma.LZMAFile("file.xz", "w") as f:
+   with lzma.open("file.xz", "w") as f:
        f.write(data)
 
 Compressing data in memory::
@@ -367,7 +367,7 @@
    import lzma
    with open("file.xz", "wb") as f:
        f.write(b"This data will not be compressed\n")
-       with lzma.LZMAFile(f, "w") as lzf:
+       with lzma.open(f, "w") as lzf:
            lzf.write(b"This *will* be compressed\n")
        f.write(b"Not compressed\n")
 
@@ -378,5 +378,5 @@
        {"id": lzma.FILTER_DELTA, "dist": 5},
        {"id": lzma.FILTER_LZMA2, "preset": 7 | lzma.PRESET_EXTREME},
    ]
-   with lzma.LZMAFile("file.xz", "w", filters=my_filters) as f:
+   with lzma.open("file.xz", "w", filters=my_filters) as f:
        f.write(b"blah blah blah")

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


More information about the Python-checkins mailing list