[issue14371] Add support for bzip2 compression to the zipfile module

Serhiy Storchaka report at bugs.python.org
Thu Apr 19 22:25:47 CEST 2012


Serhiy Storchaka <storchaka at gmail.com> added the comment:

> Perhaps because your system's memory allocator is extremely good (or buf is always very small), but b''.join() is far more robust.
> Another alternative is accumulating in a bytearray, since it uses overallocation for linear time appending.

I thought, that it was in special optimization, mentioned in the
python-dev, but could not find this in the code. Perhaps it had not been
implemented.

In this particular case, the bytes appending is performed only once (and
probably a lot of appending with b''). Exceptions are possible only in
pathological cases, for example when compressed data is much larger
uncompressed data. The current implementation uses `buf += data`, if
someone wants to change it, then it's not me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14371>
_______________________________________


More information about the Python-bugs-list mailing list