[ZODB-Dev] BTree mutating iteration

John Belmonte john at neggie.net
Fri Feb 20 17:11:50 EST 2004


Bob Ippolito wrote:
> Maybe you're thinking about iterating over the return value of a dict 
> method such as keys, values, or items.  Those are FULL COPIES of the 
> dict's keys, values, or items as a list.  Iterating a dict is done via 
> iterkeys, itervalues, iteritems, or the implicit iter (which is 
> equivalent to iterkeys, demonstrated above).

I was using the BTree's items(), which is unlike dict.items() in that it 
does not return a sequence.  While that difference is documented in the 
ZODB guide, the implications for the case of trying to mutate the 
container while using items() for iteration are not.

-John


-- 
http:// if  ile.org/



More information about the ZODB-Dev mailing list