@@ -231,10 +231,13 @@ def readline(self, size=None):
231231 """ Read one line from the input stream and return the
232232 decoded data.
233233
234- Note: Unlike the .readlines() method, line breaking must
235- be implemented by the underlying stream's .readline()
236- method -- there is currently no support for line breaking
237- using the codec decoder due to lack of line buffering.
234+ Note: Unlike the .readlines() method, this method inherits
235+ the line breaking knowledge from the underlying stream's
236+ .readline() method -- there is currently no support for
237+ line breaking using the codec decoder due to lack of line
238+ buffering. Sublcasses should however, if possible, try to
239+ implement this method using their own knowledge of line
240+ breaking.
238241
239242 size, if given, is passed as size argument to the stream's
240243 .readline() method.
@@ -288,6 +291,14 @@ def __getattr__(self,name,
288291
289292class StreamReaderWriter :
290293
294+ """ StreamReaderWriter instances allow wrapping streams which
295+ work in both read and write modes.
296+
297+ The design is such that one can use the factory functions
298+ returned by the codec.lookup() function to contruct the
299+ instance.
300+
301+ """
291302 # Optional attributes set by the file wrappers below
292303 encoding = 'unknown'
293304
@@ -346,6 +357,21 @@ def __getattr__(self,name,
346357
347358class StreamRecoder :
348359
360+ """ StreamRecoder instances provide a frontend - backend
361+ view of encoding data.
362+
363+ They use the complete set of APIs returned by the
364+ codecs.lookup() function to implement their task.
365+
366+ Data written to the stream is first decoded into an
367+ intermediate format (which is dependent on the given codec
368+ combination) and then written to the stream using an instance
369+ of the provided Writer class.
370+
371+ In the other direction, data is read from the stream using a
372+ Reader instance and then return encoded data to the caller.
373+
374+ """
349375 # Optional attributes set by the file wrappers below
350376 data_encoding = 'unknown'
351377 file_encoding = 'unknown'
@@ -452,6 +478,11 @@ def open(filename, mode, encoding=None, errors='strict', buffering=1):
452478 buffering has the same meaning as for the builtin open() API.
453479 It defaults to line buffered.
454480
481+ The returned wrapped file object provides an extra attribute
482+ .encoding which allows querying the used encoding. This
483+ attribute is only available if an encoding was specified as
484+ parameter.
485+
455486 """
456487 if encoding is not None and \
457488 'b' not in mode :
@@ -488,6 +519,11 @@ def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'):
488519 data_encoding and file_encoding are added to the wrapped file
489520 object as attributes .data_encoding and .file_encoding resp.
490521
522+ The returned wrapped file object provides two extra attributes
523+ .data_encoding and .file_encoding which reflect the given
524+ parameters of the same name. The attributes can be used for
525+ introspection by Python programs.
526+
491527 """
492528 if file_encoding is None :
493529 file_encoding = data_encoding
0 commit comments