Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / e6 / 672a9ff4a758b46c346b62219359212ad2116f
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id E5850431FD0\r
6         for <notmuch@notmuchmail.org>; Sat,  1 Nov 2014 01:08:58 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id trZ97GScag9U for <notmuch@notmuchmail.org>;\r
16         Sat,  1 Nov 2014 01:08:48 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id B5F98431FAF\r
19         for <notmuch@notmuchmail.org>; Sat,  1 Nov 2014 01:08:48 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id DAEF31000E0;\r
22         Sat,  1 Nov 2014 10:08:26 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: "W. Trevor King" <wking@tremily.us>, Jesse Rosenthal <jrosenthal@jhu.edu>\r
25 Subject: Re: [PATCH] test: Make gen-threads work with python3\r
26 In-Reply-To: <20141031174153.GQ15443@odin.tremily.us>\r
27 References: <1414776805-30000-1-git-send-email-jrosenthal@jhu.edu>\r
28         <20141031174153.GQ15443@odin.tremily.us>\r
29 User-Agent: Notmuch/0.18.1+130~ga61922f (http://notmuchmail.org) Emacs/24.3.1\r
30         (x86_64-unknown-linux-gnu)\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
32         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
33         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
34 Date: Sat, 01 Nov 2014 10:08:26 +0200\r
35 Message-ID: <m2vbmzfimd.fsf@guru.guru-group.fi>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain; charset=utf-8\r
38 Content-Transfer-Encoding: quoted-printable\r
39 Cc: notmuch@notmuchmail.org\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Sat, 01 Nov 2014 08:08:59 -0000\r
53 \r
54 On Fri, Oct 31 2014, "W. Trevor King" <wking@tremily.us> wrote:\r
55 \r
56 > On Fri, Oct 31, 2014 at 01:33:25PM -0400, Jesse Rosenthal wrote:\r
57 >> We instead initalize the dictionary using the dict comprehension and\r
58 >> then update it with the values from the tree. This will work with\r
59 >> both python2 and python3.\r
60 >\r
61 > Dict comprehensions are new in 2.7 [1,2], so this drops support for\r
62 > systems where =E2=80=98python=E2=80=99 means =E2=80=98python2.6=E2=80=99.=\r
63   Personally, I'm fine with\r
64 > that, but I thought I'd point it out in case 2.6 users wanted to push\r
65 > back ;).\r
66 \r
67 Thanks Trevor. The original changed line:\r
68 \r
69 -  ntree =3D dict(tree, **{child: to_expand[0] for child in children})\r
70 \r
71 is already incompatible with python 2.6, so this doesn't change the current=\r
72 =20\r
73 status quo there.\r
74 \r
75 The above changed to=20\r
76 \r
77 +  ntree =3D dict(tree, **dict((child, to_expand[0]) for child in children))\r
78 \r
79 works in Python 2.6 (if anyone interested), and it looks the change in this\r
80 patch is not difficult to make work in python 2.6 in case anyone\r
81 desires to do so...\r
82 \r
83 Although I have ready-made patch to make the former code work in python 2.6\r
84 I've thought that maybe it is just unnecessary burden to support python 2.6\r
85 there -- so that people can concentrate on improving tests instead...\r
86 \r
87 Therefore, +1 for this patch, provided that it works as expected.\r
88 \r
89 Tomi\r
90 \r
91 \r
92 >\r
93 >> diff --git a/test/gen-threads.py b/test/gen-threads.py\r
94 >> index 9fbb847..70fb1f6 100644\r
95 >> --- a/test/gen-threads.py\r
96 >> +++ b/test/gen-threads.py\r
97 >> @@ -2,7 +2,6 @@\r
98 >>  # argv[1].  Each output line is a thread structure, where the n'th\r
99 >>  # field is either a number giving the parent of message n or "None"\r
100 >>  # for the root.\r
101 >> -\r
102 >>  import sys\r
103 >\r
104 > Why remove this blank line?\r
105 >\r
106 >>  from itertools import chain, combinations\r
107 >>=20=20\r
108 >> @@ -28,6 +27,7 @@ while queue:\r
109 >>      else:\r
110 >>          # Expand node to_expand[0] with each possible set of children\r
111 >>          for children in subsets(free):\r
112 >> -            ntree =3D dict(tree, **{child: to_expand[0] for child in ch=\r
113 ildren})\r
114 >> +            ntree =3D {child: to_expand[0] for child in children}\r
115 >> +            ntree.update(tree)\r
116 >\r
117 > This looks good to me.\r
118 >\r
119 > Cheers,\r
120 > Trevor\r
121 >\r
122 > [1]: https://docs.python.org/3/whatsnew/2.7.html#other-language-changes\r
123 > [2]: http://legacy.python.org/dev/peps/pep-0274/\r
124 >\r
125 > --=20\r
126 > This email may be signed or encrypted with GnuPG (http://www.gnupg.org).\r
127 > For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\r
128 > _______________________________________________\r
129 > notmuch mailing list\r
130 > notmuch@notmuchmail.org\r
131 > http://notmuchmail.org/mailman/listinfo/notmuch\r