[issue11501] distutils.archive_util should handle absence of zlib module

Natalia B. Bidart report at bugs.python.org
Tue Mar 15 13:40:34 CET 2011


Natalia B. Bidart <nataliabidart at gmail.com> added the comment:

On Tue, Mar 15, 2011 at 7:15 AM, Éric Araujo <report at bugs.python.org> wrote:
>
> Éric Araujo <merwok at netwok.org> added the comment:
>
>> I'm not using "if zlib is not None" since the archive_utils module
>> never explicitly imports zlib.
>
> Well, you can import zlib in that module too to detect in advance whether zipfile will work.

Indeed, but from my POV that's less cleaner than the proposed
solution: importing a module that is not used (other than checking for
a condition) may generate confusion to a reader. IMHO, the proposed
solution may ease the readability of the code block by being
super-explicit about what condition is being handled when creating the
ZipFile.

Let me know if you still consider I should change that.

----------

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


More information about the Python-bugs-list mailing list