summaryrefslogtreecommitdiff
path: root/docs/library
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2018-09-29 13:23:33 +0300
committerDamien George <damien.p.george@gmail.com>2018-10-18 12:39:25 +1100
commit5f7088f84dc491c006fcf6262d89096a8e2ffc44 (patch)
tree6da04a9ad011a785bbce6107469fb9326ab61880 /docs/library
parenta07e56cbd8adfaa9f3f456ec0173e40c647fbb05 (diff)
docs/uio: Document StringIO/BytesIO(alloc_size) constructors.
Diffstat (limited to 'docs/library')
-rw-r--r--docs/library/uio.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/library/uio.rst b/docs/library/uio.rst
index 81420702d..1a64b3658 100644
--- a/docs/library/uio.rst
+++ b/docs/library/uio.rst
@@ -112,3 +112,18 @@ Classes
.. method:: getvalue()
Get the current contents of the underlying buffer which holds data.
+
+.. class:: StringIO(alloc_size)
+.. class:: BytesIO(alloc_size)
+
+ Create an empty `StringIO`/`BytesIO` object, preallocated to hold up
+ to *alloc_size* number of bytes. That means that writing that amount
+ of bytes won't lead to reallocation of the buffer, and thus won't hit
+ out-of-memory situation or lead to memory fragmentation. These constructors
+ are a MicroPython extension and are recommended for usage only in special
+ cases and in system-level libraries, not for end-user applications.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ These constructors are a MicroPython extension.