From d3820fe823087fff37433fb0b2cb76c0b984fe44 Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Tue, 22 May 2018 14:06:37 +0100 Subject: DOC: Clarify tofile requirement Clarify that tofile requires a file that can be directly written to and not a general file-like object --- numpy/add_newdocs.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'numpy/add_newdocs.py') diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index e8030d562..fc2130096 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -4759,6 +4759,11 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('tofile', machines with different endianness. Some of these problems can be overcome by outputting the data as text files, at the expense of speed and file size. + + When fid is a file object, array contents are directly written to the + file, bypassing the file object's ``write`` method. As a result, tofile + cannot be used with files objects supporting compression (e.g., GzipFile) + or file-like objects that do not support ``fileno()`` (e.g., BytesIO). """)) -- cgit v1.2.1