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. /Jorgen -- // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu \X/ snipabacken.se> R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list