Comment 3 for bug 541637

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 541637] Re: searchTasks doesn't return all matching tasks?!

On 20 March 2010 00:22, Gary Poster <email address hidden> wrote:
> I'm inclined to change the title of this bug to the following.
>
>    Mutating results of iterator can produce incorrect results in
> iterator
>
> I'd then mark as "Wont Fix" at worst or "Triaged: Low" at best.  While
> not ideal, this is not surprising behavior to me, and pretty typical of
> Python iterators.

That's true. It's only surprising to me because my model (which may
well be wrong) is that each rpc returned a new batch of objects which
were essentially just buffered on the client. In other words, it's
more like objects from a file in sequence and then mutating them than
it is like mutating a dict while you're iterating it.

> I can think of two arguments that would change my mind.  Maybe there are
> more. :-)
>
> 1) list(iterator) gives the wrong answer.
>
> 2) you can't know if list(iterator) will be too big or problematic in
> some other way.
>
> This also should have Leonard's weigh-in, which won't happen till next
> week.

Is the problem here that I'm mutating the list, or could it also
happen if they were being changed by someone else on Launchpad? If
the latter there is no way any particular client could avoid it.

--
Martin <http://launchpad.net/~mbp/>