Commit b3224875 authored by Benjamin Peterson's avatar Benjamin Peterson

group cStringIO docs under its factory function

parent 86aa9053
...@@ -71,24 +71,29 @@ The module :mod:`cStringIO` provides an interface similar to that of the ...@@ -71,24 +71,29 @@ The module :mod:`cStringIO` provides an interface similar to that of the
made more efficient by using the function :func:`StringIO` from this module made more efficient by using the function :func:`StringIO` from this module
instead. instead.
Since this module provides a factory function which returns objects of built-in
types, there's no way to build your own version using subclassing. It's not .. function:: StringIO([s])
possible to set attributes on it. Use the original :mod:`StringIO` module in
those cases. Return a StringIO-like stream for reading or writing.
Unlike the memory files implemented by the :mod:`StringIO` module, those Since this is a factory function which returns objects of built-in types,
provided by this module are not able to accept Unicode strings that cannot be there's no way to build your own version using subclassing. It's not
encoded as plain ASCII strings. possible to set attributes on it. Use the original :mod:`StringIO` module in
those cases.
Calling :func:`StringIO` with a Unicode string parameter populates
the object with the buffer representation of the Unicode string, instead of Unlike the :mod:`StringIO` module, this module is not able to accept Unicode
encoding the string. strings that cannot be encoded as plain ASCII strings. Calling
:func:`StringIO` with a Unicode string parameter populates the object with
Another difference from the :mod:`StringIO` module is that calling the buffer representation of the Unicode string instead of encoding the
:func:`StringIO` with a string parameter creates a read-only object. Unlike an string.
object created without a string parameter, it does not have write methods.
These objects are not generally visible. They turn up in tracebacks as Another difference from the :mod:`StringIO` module is that calling
:class:`StringI` and :class:`StringO`. :func:`StringIO` with a string parameter creates a read-only object. Unlike an
object created without a string parameter, it does not have write methods.
These objects are not generally visible. They turn up in tracebacks as
:class:`StringI` and :class:`StringO`.
The following data objects are provided as well: The following data objects are provided as well:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment