On Thu, Nov 5, 2009 at 6:30 PM, geremy condra <debat...@gmail.com> wrote:
> I'm testing the speed because the claim was made that the pop/add
> approach was inefficient. Here's the full quote:
>
>>    The obvious way, for newcomers, of achieving the effect is:
>>
>>  x = s.pop()
>>  s.add(x)
>>
>> ... and that's simply horrible in terms of efficiency.  So the
>> "obvious" way of doing it in Python is wrong(TM), and the "correct"
>> way of doing it is obscure and raises misleading exceptions.

   I was talking mainly from a theoretical standpoint, and because the
library I'm working on is designed to work seamlessly over the
network.  In those cases, where the set the user is working with is
actually a proxy object across the wire, the time to acquire the
locks, remove the object, release the locks, reacquire the locks, add
the object, then rerelease the locks is *significantly* more expensive
than just noting the set hasn't changed and returning a cached object
from it.

-- Chris
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to