durusmail: durus-users: some btree enhancements
some btree enhancements
2005-07-13
2005-07-13
2005-07-13
2005-07-13
2005-07-13
Re: __len__ for Btrees was Re: [Durus-users] some btree enhancements
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-09-09
some btree enhancements
Mario Ruggier
2005-07-13
On Jul 13, 2005, at 3:57 PM, David Binger wrote:
> On Jul 13, 2005, at 7:57 AM, David Binger wrote:
>> On Jul 13, 2005, at 2:26 AM, Mario Ruggier wrote:
>>
>>>
>>> Plus, inadvertently I was doing "for key in btree" and modifying the
>>> btree
>>> within the loop. Equivalent action on a dict will throw a
>>> RuntimeError.
>>> Shouldn't BTree also do that?
>>>
>>>
>>
>> Yes.
>>
>
> But, does anyone know a way to implement this that is simple,
> reliable, and efficient?
> Every option I've considered seems worse than leaving this as it is.

Yes, looking at the code, you are right... the added runtime overhead
to check this during iteration may not be worth it.

Probably silly, but it seems to me that bnode.__iter__ would need to
check for any "iter-conflicting" changes since last yield...

Given the complication, plus runtime price, I would be probably agree
that it is preferable as it is. I was surprised by it once, but it is
done now ;)

mario

reply