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 C97BA429E39 for ; Mon, 2 Jan 2012 05:15:06 -0800 (PST) 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 yw+NPM3fTIij for ; Mon, 2 Jan 2012 05:15:06 -0800 (PST) Received: from mail-gw3.nixu.fi (mail-gw3.nixu.fi [193.209.237.7]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 1CA86431FD0 for ; Mon, 2 Jan 2012 05:15:05 -0800 (PST) Received: from pps.filterd (mail-gw3 [127.0.0.1]) by mail-gw3.nixu.fi (8.14.4/8.14.4) with SMTP id q02DF3hV005358; Mon, 2 Jan 2012 15:15:03 +0200 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31]) by mail-gw3.nixu.fi with ESMTP id 114cs0wwtv-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 02 Jan 2012 15:15:02 +0200 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31]) by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id q02DF1CV002155; Mon, 2 Jan 2012 15:15:01 +0200 From: Tomi Ollila To: Justus Winter <4winter@informatik.uni-hamburg.de>, notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] python: make the result of Message.get_replies() more pythonic In-Reply-To: <1324473302-10869-3-git-send-email-4winter@informatik.uni-hamburg.de> References: <87sjm79e3d.fsf@SSpaeth.de> <1324473302-10869-1-git-send-email-4winter@informatik.uni-hamburg.de> <1324473302-10869-3-git-send-email-4winter@informatik.uni-hamburg.de> User-Agent: Notmuch/0.10.2+157~g442d405 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110, 1.0.211, 0.0.0000 definitions=2012-01-02_03:2012-01-02, 2012-01-02, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1012030000 definitions=main-1201020085 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: Mon, 02 Jan 2012 13:15:07 -0000 On Wed, 21 Dec 2011 14:15:02 +0100, Justus Winter <4winter@informatik.uni-hamburg.de> wrote: > Formerly Message.get_replies() returned an iterator or None forcing > users to check the result before iterating over it leading to strange > looking code at the call site. > > Fix this flaw by adding an EmptyMessagesResult class that behaves like > the Messages class but immediatly raises StopIteration if used as an > iterator and returning objects of this type from Message.get_replies() > to indicate that there are no replies. > --- > bindings/python/notmuch/message.py | 22 +++++++++++++++------- > 1 files changed, 15 insertions(+), 7 deletions(-) LGTM, but does this break any current software using this API ? Tomi