[ZODB-Dev] lazy BTreeItems

Victor Safronovich vsafronovich at naumen.ru
Fri Dec 9 02:05:23 EST 2005


Hello zodb-dev!

Is this a correct behaviour?
>>> from BTrees.IIBTree import IIBTree
>>> t = IIBTree(map(None,range(5),range(5)))
>>> list(t.keys())
[0, 1, 2, 3, 4]
>>> k = t.keys()
>>> list(k)
[0, 1, 2, 3, 4]
>>> del t[0]
>>> list(k)
[]

BUT
>>> i = iter(t.keys())
>>> del t[1]
>>> list(i)
[2, 3, 4]

Or should I always cast to unlazy list, when i want to remove some keys from btree?
And how did iterator return 2,3,4 keys?

-- 
Best regards,
 Victor Safronovich
 NauMen.NauDoc.SoftwareDeveloper  http://www.naumen.ru



More information about the ZODB-Dev mailing list