[docs] Behavior of ZipFile with file-like object and BufferedWriter. (issue 20699)

vadmium+py at gmail.com vadmium+py at gmail.com
Sat May 21 20:20:22 EDT 2016


https://bugs.python.org/review/20699/diff/16966/Doc/library/io.rst
File Doc/library/io.rst (right):

https://bugs.python.org/review/20699/diff/16966/Doc/library/io.rst#newcode597
Doc/library/io.rst:597: The argument *initial_bytes* is a
:term:`bytes-like object` that
On 2016/05/19 08:45:20, storchaka wrote:
> Maybe "The optional argument"?

Sure

https://bugs.python.org/review/20699/diff/16966/Lib/_pyio.py
File Lib/_pyio.py (right):

https://bugs.python.org/review/20699/diff/16966/Lib/_pyio.py#newcode678
Lib/_pyio.py:678: """Read bytes into buffer *b*, using at most one
system call
On 2016/05/19 08:45:20, storchaka wrote:
> Should this be unified with readinto()?

I don’t want to copy the wording from readinto(), because I want to keep
the first line of the doc string a short summary (while still mentioning
“one system call”).

https://bugs.python.org/review/20699/diff/16966/Lib/test/test_io.py
File Lib/test/test_io.py (right):

https://bugs.python.org/review/20699/diff/16966/Lib/test/test_io.py#newcode320
Lib/test/test_io.py:320: self.assertEqual(memoryview(data).tobytes(), b"
worl")
On 2016/05/19 08:45:20, storchaka wrote:
> Maybe just "bytes(data)"?

I probably wrote the longer version with Python 2 compatibility in mind.
But I see that neither of my byteslike() functions will work as they are
with Python 2, so I may as well use the simpler version.

https://bugs.python.org/review/20699/diff/16966/Lib/test/test_io.py#newcode667
Lib/test/test_io.py:667: def make_file_writer():
On 2016/05/19 08:45:20, storchaka wrote:
> Yet more short and clear writing is:
> 
> def check(f):
>     with f:
>         self.assertEqual(f.write(a), n)
>         f.writelines((a,))
> check(self.BytesIO())
> check(self.FileIO(support.TESTFN, "w"))
> ...
> 
> Only 9 lines!

Thankyou, I used this version

https://bugs.python.org/review/20699/


More information about the docs mailing list