[ZODB-Dev] BTree mutating iteration
Bob Ippolito
bob at redivi.com
Fri Feb 20 17:20:44 EST 2004
On Feb 20, 2004, at 5:11 PM, John Belmonte wrote:
> 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.
I see, it would make sense to rename BTree's items to iteritems, and
deprecate the items method then.
-bob
More information about the ZODB-Dev
mailing list