From: Karl Hasselström Date: Sat, 14 Jun 2008 10:26:46 GMT Subject: Re: [StGit PATCH] compressed import v3 Message-ID: <20080614102646.GD14282@diana.vm.bytemark.co.uk> In-Reply-To: <485289FD.50808@gmail.com> On 2008-06-13 09:53:49 -0500, Clark Williams wrote: > I'm interested to hear how you'd condense the code in > __gethandleandname(). Like this, for example: import bz2, gzip for copen, ext in [(gzip.open, '.gz'), (bz2.BZ2File, '.bz2')]: try: f = copen(filename) f.read(1) f.seek(0) return (f, __mkpatchname(filename, ext)) except IOError, e: pass If you don't mind, I'll just fix that up directly in your patch. (I also took the liberty to rename the function to __get_handle_and_name, since that's more consistent with other functions in that file.) -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle