unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Sebastian Spaeth <Sebastian@SSpaeth.de>
To: Brian May <brian@microcomaustralia.com.au>,
	Patrick Totzke <patricktotzke@googlemail.com>
Cc: notmuch <notmuch@notmuchmail.org>
Subject: Re: [python] get all messages of a thread
Date: Thu, 02 Jun 2011 09:05:29 +0200	[thread overview]
Message-ID: <87aae07lxi.fsf@SSpaeth.de> (raw)
In-Reply-To: <BANLkTikEJ9dJ5kLg2QJQ+egHg2sh7S1wiA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2011-06-02  7:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28 13:18 [python] get all messages of a thread Patrick Totzke
2011-05-31 23:48 ` Carl Worth
2011-06-01  5:35 ` Brian May
2011-06-02  7:05   ` Sebastian Spaeth [this message]
2011-06-02  9:43     ` Brian May
2011-06-02 14:20       ` Sebastian Spaeth
2011-06-02 14:37         ` Sebastian Spaeth
2011-06-02 14:38         ` Austin Clements

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=87aae07lxi.fsf@SSpaeth.de \
    --to=sebastian@sspaeth.de \
    --cc=brian@microcomaustralia.com.au \
    --cc=notmuch@notmuchmail.org \
    --cc=patricktotzke@googlemail.com \
    /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).