unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <bremner@debian.org>
To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org
Subject: Re: [PATCH v3] nmbug: Translate to Python
Date: Mon, 04 Aug 2014 21:14:46 -0300	[thread overview]
Message-ID: <878un36bd5.fsf@maritornes.cs.unb.ca> (raw)
In-Reply-To: <84447a0ed48412e1587761d560d18cb5affd4f66.1405897133.git.wking@tremily.us>

"W. Trevor King" <wking@tremily.us> 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

  parent reply	other threads:[~2014-08-05  0:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-20 22:59 [PATCH v3] nmbug: Translate to Python W. Trevor King
2014-07-20 23:11 ` W. Trevor King
2014-07-20 23:34 ` W. Trevor King
2014-07-21  0:21 ` W. Trevor King
2014-08-05  0:14 ` David Bremner [this message]
2014-08-06  1:16   ` David Bremner
2014-08-06 23:28     ` W. Trevor King
2014-08-24 20:02       ` David Bremner
2014-08-06  1:24   ` David Bremner
2014-08-06 23:38     ` W. Trevor King
2014-08-24 20:07       ` David Bremner
2014-08-06 23:21   ` W. Trevor King
2014-08-24 20:39     ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878un36bd5.fsf@maritornes.cs.unb.ca \
    --to=bremner@debian.org \
    --cc=notmuch@notmuchmail.org \
    --cc=wking@tremily.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).