Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 53CAB431FD0 for ; Thu, 2 Jun 2011 00:05:49 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.09 X-Spam-Level: X-Spam-Status: No, score=-0.09 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, T_MIME_NO_TEXT=0.01] 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 fBd-KXKp0B3v for ; Thu, 2 Jun 2011 00:05:48 -0700 (PDT) Received: from homiemail-a19.g.dreamhost.com (caiajhbdccah.dreamhost.com [208.97.132.207]) by olra.theworths.org (Postfix) with ESMTP id B55CF431FB6 for ; Thu, 2 Jun 2011 00:05:48 -0700 (PDT) Received: from homiemail-a19.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTP id D817F604084; Thu, 2 Jun 2011 00:05:47 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=SSpaeth.de; h=from:to:cc:subject :in-reply-to:references:date:message-id:mime-version: content-type; q=dns; s=sspaeth.de; b=flVEbuy11SPZs76/MlgZ/brIf4e UjI6F3fj24hbnVp9YlrJr/Qs0iPkeRpnGndDQckR9TFBW2r7Z7WvKze1CE7cBHdv I6jcYboBTC7fEhcnN3Ss6R5li73vlnKG0EiN6v0F5WEVuA7G5J2Yt+dAA6tCK3OA /xy/8FuL1YGEz0jA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=SSpaeth.de; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version: content-type; s=sspaeth.de; bh=LcWpqYo8zAqiH9WOcrczEC23w/Q=; b=g 0iQ47vmE3WlvTBsw7yUvv24OUlXgGfR9c07i+7Q2sNhiK9t2D1xEitRrlglWXTaV zPlTFn3vkYZcQSYYjw8RZT9v79SpTIFW3yerNRtZuZh+3wHiEMiJeGIR0J6lJJmt qf0kN20QErTsM/w8nqRdn1cycs00C3aaTrXir+Vbx8= Received: from spaetzbook.sspaeth.de (unknown [195.250.171.64]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: fax@sspaeth.de) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTPSA id 56CBC604079; Thu, 2 Jun 2011 00:05:40 -0700 (PDT) Received: by spaetzbook.sspaeth.de (sSMTP sendmail emulation); Thu, 02 Jun 2011 09:05:29 +0200 From: Sebastian Spaeth To: Brian May , Patrick Totzke Subject: Re: [python] get all messages of a thread In-Reply-To: References: <1306588052-sup-9838@brick> User-Agent: Notmuch/0.5-209-gc8b5718 (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Thu, 02 Jun 2011 09:05:29 +0200 Message-ID: <87aae07lxi.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: notmuch 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: Thu, 02 Jun 2011 07:05:49 -0000 --=-=-= On Wed, 1 Jun 2011 15:35:35 +1000, Brian May wrote: > Oh, I see, for your code, there is a implied call to __len__, and the > __len__ function is completely broken for the reasons described in the > documentation: It seems to have been a bad idea to implement __len__ at all for the Messsages() construct in the python bindings, and I wonder if I should remove it. On the other hand, it seems that list(Messages()) implicitely calls len(), or so it seems from the error that we get when trying to list() a messages object. An alternative is to implement len() as a call to count_messages() which has for me so far always returned the correct number of messages without using up the iterator. However, the xapian docs explicitely state that it does not guarantee that the count will be correct, so len() might return a wrong message size (potentially). What would be the best way to solve this (besides fixing the C api to allow to reset the iterator ;-) ?) I could implement a custom .as_list() function that returns the Messages() object as a list that is guaranteed to be stable, by copying out the Message() objects into a list. Sebastian --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk3nNjkACgkQVYX1jMgnoGJwrwCfTDJ4FxGbMYRyI8rcWrHvOHTz lDsAnR1MA0rfwKMBBJzAVLJ73jZpbInt =98j3 -----END PGP SIGNATURE----- --=-=-=--