Size: 899
Comment:
|
Size: 919
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 27: | Line 27: |
See also: StreamWriter, StreamRecoder. | See also: StreamWriter, StreamReaderWriter, StreamRecoder. |
As of Python2.5, StreamReader wraps (contains) a stream. It defines read and other respective methods to read the data from the stream and "decode" them. The class exposes all other methods of the stream instance.
Pseudocode of the codecs.StreamReader definition:
The decode method normally converts values of type str to unicode.
Codec modules will attach the decode method to the class definition derived from StreamReader during the initialization. An excerpt from encodings.utf_8.StreamReader:
Toggle line numbers
1 class StreamReader(codecs.StreamReader):
2 decode = codecs.utf_8_decode
See also: StreamWriter, StreamReaderWriter, StreamRecoder.