diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-06-29 15:18:02 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-06-29 15:18:02 (GMT) |
commit | b32248757d988141073a4bfc0f72544e9f6a5e22 (patch) | |
tree | c0f7f69c8ba9f2c570ce2d1ed31325384d479bde /Doc | |
parent | 86aa90539b1fc388b8daca8c014bcda93f00d305 (diff) | |
download | cpython-b32248757d988141073a4bfc0f72544e9f6a5e22.zip cpython-b32248757d988141073a4bfc0f72544e9f6a5e22.tar.gz cpython-b32248757d988141073a4bfc0f72544e9f6a5e22.tar.bz2 |
group cStringIO docs under its factory function
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stringio.rst | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/Doc/library/stringio.rst b/Doc/library/stringio.rst index 30a5bac..0177da4 100644 --- a/Doc/library/stringio.rst +++ b/Doc/library/stringio.rst @@ -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 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 -possible to set attributes on it. Use the original :mod:`StringIO` module in -those cases. - -Unlike the memory files implemented by the :mod:`StringIO` module, those -provided by this module are not able to accept Unicode strings that cannot be -encoded as plain ASCII strings. - -Calling :func:`StringIO` with a Unicode string parameter populates -the object with the buffer representation of the Unicode string, instead of -encoding the string. - -Another difference from the :mod:`StringIO` module is that calling -: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`. + +.. function:: StringIO([s]) + + Return a StringIO-like stream for reading or writing. + + Since this is a factory function which returns objects of built-in types, + there's no way to build your own version using subclassing. It's not + possible to set attributes on it. Use the original :mod:`StringIO` module in + those cases. + + Unlike the :mod:`StringIO` module, this module is not able to accept Unicode + strings that cannot be encoded as plain ASCII strings. Calling + :func:`StringIO` with a Unicode string parameter populates the object with + the buffer representation of the Unicode string instead of encoding the + string. + + Another difference from the :mod:`StringIO` module is that calling + :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: |