Hi all --

   I looked through the bug tracker, but I didn't see this listed.  I
was trying to use the bz2 codec, but it seems like it's not very
useful in the current form (and I'm not sure if it's getting added
back to py3k, so maybe this is a moot point).  It looks like the codec
writes every piece of data fed to it as a separate compressed block.
This results in compressed files which are significantly larger than
the uncompressed files, if you're writing a lot of small bursts of
data.  It also leads to interesing oddities like this:

    import codecs

    with codecs.open('text.bz2', 'w', 'bz2') as f:
        for x in xrange(20):
            f.write('This is data %i\n' % x)

    with codecs.open('text.bz2', 'r', 'bz2') as f:
        print f.read()

This prints "This is data 0" and exits, because the codec won't read
beyond the first compressed block.

My question is, is this known, intended behavior?  Should I open a bug
report?  Is it going away in py3k, so there's no real point in fixing
it?

-- Chris
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to