[Python-Dev] Question on bz2 codec. Is this a bug?

Antoine Pitrou solipsis at pitrou.net
Wed Sep 29 23:23:51 CEST 2010


On Wed, 29 Sep 2010 23:05:38 +0200
"M.-A. Lemburg" <mal at egenix.com> wrote:
> 
> The codec is scheduled to be added back to Python3.
> 
> However, it's main use is in working on whole chunks of
> data rather than the line-by-line approach you're after.
> This is provided by the codec's incremental encoder/decoders,
> but these are currently not used by codecs.open() and
> I'm not sure whether the io lib uses them, which could
> be used via the regular open().

The io lib will not work with a codec which doesn't return unicode
strings.

Anyway, the obvious way to write line-by-line to a bz2 file is to use
the BZ2File class!

Regards

Antoine.




More information about the Python-Dev mailing list