On 15.01.2015 05:43, Martin Panter wrote: > > New patch that also fixes StreamWriter.writelines() in general for the byte > codecs
Could you explain this new undocumented class ? +class _IncrementalBasedWriter(StreamWriter): + """Generic StreamWriter implementation. + + The _EncoderClass attribute must be set to an IncrementalEncoder + class to use. + """ + + def __init__(self, stream, errors='strict'): + super().__init__(stream, errors) + self._encoder = self._Encoder(errors) + + def write(self, object): + self.stream.write(self._encoder.encode(object)) + + def reset(self): + self.stream.write(self._encoder.encode(final=True)) + Note that the doc-string mentions a non-existing attribute and there are doc-string missing for the other methods. The purpose appears to be a StreamWriter which works with an IncrementalEncoder. A proper name would thus be IncrementalStreamWriter which provides an .encode() method which adapts the signature of the incremental encoder to the one expected for StreamWriters and Codecs. -- Marc-Andre Lemburg eGenix.com _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com