From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 5E201431FBC for ; Mon, 4 Aug 2014 17:14:58 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lusK2EocsODv for ; Mon, 4 Aug 2014 17:14:52 -0700 (PDT) Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A70CF431FAE for ; Mon, 4 Aug 2014 17:14:52 -0700 (PDT) Received: from remotemail by yantan.tethera.net with local (Exim 4.80) (envelope-from ) id 1XESOx-0000KB-8O; Mon, 04 Aug 2014 21:14:51 -0300 Received: (nullmailer pid 9215 invoked by uid 1000); Tue, 05 Aug 2014 00:14:46 -0000 From: David Bremner To: "W. Trevor King" , notmuch@notmuchmail.org Subject: Re: [PATCH v3] nmbug: Translate to Python In-Reply-To: <84447a0ed48412e1587761d560d18cb5affd4f66.1405897133.git.wking@tremily.us> References: <84447a0ed48412e1587761d560d18cb5affd4f66.1405897133.git.wking@tremily.us> User-Agent: Notmuch/0.18.1+45~gf47eeac (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Mon, 04 Aug 2014 21:14:46 -0300 Message-ID: <878un36bd5.fsf@maritornes.cs.unb.ca> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2014 00:14:58 -0000 "W. Trevor King" writes: > * Commands are no longer split into "most common", "other useful", and > "less common" sets. If we need something like this, I'd prefer > workflow examples highlighting common commands in the module > docstring (available with 'nmbug --help'). > I don't feel strongly about this, but I remember implementing it by request in the first version. OTOH, I think you shortened up the main help string when you split it. We may want to think about a seperate man page as a follow project. One thing I did notice is that there is no hint to call nmbug {command} --help in the main docstring. > +#!/usr/bin/env python > +# Copyright (c) 2011 David Bremner > +# License: same as notmuch You should add your self, update the date, and probably explicitly state the license, as in Carl's patch for nmbug-status. > +__version__ = '0.2' Do we need/want a version distinct from that of notmuch? > +def _hex_quote(string, safe='+@=:,'): I'm not sure I really understand what makes a function/variable "private" and hence prefixed with _ in your translation. > + status, tree, stderr = _git( as a non-native speaker of python, I find this a bit hard to read. How about adding some parens to make the multiple return more clear, so (status, tree, stderr) = _git( > + for id, tags in status['deleted'].items(): same comment here. > + > +def merge(reference='@{upstream}'): > + """ I did notice that merging was noticably noisier than I remembered. > + output = _collections.defaultdict( > + lambda : _collections.defaultdict( # {tag: status_string} > + lambda : ' ')) # default local status The initial comment is confusing (to me) because it looks like code. The two layers of defaultdict are a bit confusing too; it would help to mention the key of the outer dictionary. I guess it makes sense to go for a relatively straight translation as a first step; I did wonder about whether using the python bindings to notmuch would speed things up. Any ideas about how to even figure out where the bottlenecks are? d