Jorgen Grahn wrote:
On Sat, 06 Dec 2008 10:01:10 +0000, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:

...
Why use (open, gzp.GzipFile)[Entry.endswith(".gz")] when we have had
contitional expressions for a few years now?  Instead, you can write

    (gzip.GzipFile if entry.endswidth(".gz") else open).

I think it will be faster (as it doesn't require the construction of a
tuple and then the retrieval of one of its elements) and clearer.

Even clearer would be if gzip.Gzipfile could (optionally) read
non-gzipped files and file-like objects, like the gzip Unix commands
zcat -f, zgrep and so on.

Also, making a decision based on the .gz part of the name isn't
always correct -- you miss files named foo.Z and similar.

gzip is for reading gzipped files. IMHO it would be better to have a de-archive module which uses the gzip, tarfile, etc, modules as necessary.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to