From: Karl Wiberg Date: Wed, 02 Dec 2009 07:03:51 GMT Subject: Re: [StGit PATCH v2 3/6] stg mail: make __send_message do more Message-ID: In-Reply-To: <20091202004616.7737.60382.stgit@bob.kio> Just pointing out a couple of Python tricks you might've wanted to use. No need to update the patch, though. On Wed, Dec 2, 2009 at 1:46 AM, Alex Chiang wrote: > + (patch_nr, total_nr) = (args[1], args[2]) Can be written as (patch_nr, total_nr) = args[1:3] or, if args[2] is the last element of the list (which it isn't in this case?), (patch_nr, total_nr) = args[1:] > + for (p, n) in zip(patches, range(1, total_nr + 1)): > + msg_id = __send_message('patch', tmpl, options, p, n, total_nr, ref_id) Can be written as for (n, p) in enumerate(patches): if you use n + 1 instead of n in the loop body. -- Karl Wiberg, kha@treskal.com subrabbit.wordpress.com www.treskal.com/kalle