Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libstringio.tex @ 15164:8930ec3bc00a legacy-trunk
Added additional test cases for pulldom modifications.
| author | Lars Gustäbel <lars@gustaebel.de> |
|---|---|
| date | Wed, 11 Oct 2000 22:36:00 +0000 |
| parents | a71c636b85d1 |
| children | 68de9185b41e |
| rev | line source |
|---|---|
| 8918 | 1 \section{\module{StringIO} --- |
| 10661 | 2 Read and write strings as files} |
| 3 | |
|
8730
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 \declaremodule{standard}{StringIO} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 \modulesynopsis{Read and write strings as if they were files.} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 This module implements a file-like class, \class{StringIO}, |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
9 that reads and writes a string buffer (also known as \emph{memory |
| 10661 | 10 files}). See the description on file objects for operations (section |
| 11 \ref{bltin-file-objects}). | |
|
8730
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
13 \begin{classdesc}{StringIO}{\optional{buffer}} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 When a \class{StringIO} object is created, it can be initialized |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 to an existing string by passing the string to the constructor. |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 If no string is given, the \class{StringIO} will start empty. |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
17 \end{classdesc} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
18 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 The following methods of \class{StringIO} objects require special |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
20 mention: |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
21 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
22 \begin{methoddesc}{getvalue}{} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
23 Retrieve the entire contents of the ``file'' at any time before the |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
24 \class{StringIO} object's \method{close()} method is called. |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
25 \end{methoddesc} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
26 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
27 \begin{methoddesc}{close}{} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
28 Free the memory buffer. |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
29 \end{methoddesc} |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
30 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
31 |
| 8918 | 32 \section{\module{cStringIO} --- |
| 10661 | 33 Faster version of \module{StringIO}} |
|
10240
359244fa6b52
Use current approach to record documentation author.
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
34 |
|
8730
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 \declaremodule{builtin}{cStringIO} |
| 10661 | 36 \modulesynopsis{Faster version of \module{StringIO}, but not |
| 37 subclassable.} | |
| 38 \moduleauthor{Jim Fulton}{jfulton@digicool.com} | |
|
10240
359244fa6b52
Use current approach to record documentation author.
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
39 \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} |
|
8730
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
40 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
41 The module \module{cStringIO} provides an interface similar to that of |
| 10661 | 42 the \refmodule{StringIO} module. Heavy use of \class{StringIO.StringIO} |
|
8730
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
43 objects can be made more efficient by using the function |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
44 \function{StringIO()} from this module instead. |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
45 |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
46 Since this module provides a factory function which returns objects of |
|
8a306dfd9f33
Move files around to get the names to match the module names except for
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
47 built-in types, there's no way to build your own version using |
| 10661 | 48 subclassing. Use the original \refmodule{StringIO} module in that case. |
| 49 | |
| 50 The following data objects are provided as well: | |
| 51 | |
| 52 | |
| 53 \begin{datadesc}{InputType} | |
| 54 The type object of the objects created by calling | |
| 55 \function{StringIO} with a string parameter. | |
| 56 \end{datadesc} | |
| 57 | |
| 58 \begin{datadesc}{OutputType} | |
| 59 The type object of the objects returned by calling | |
| 60 \function{StringIO} with no parameters. | |
| 61 \end{datadesc} | |
| 62 | |
| 63 | |
| 64 There is a C API to the module as well; refer to the module source for | |
| 65 more information. |
