Marc 'BlackJack' Rintsch wrote:
>>> Wrong, alas: each assignment *could* cause the dictionary's internal
>>> structures to be reorganized (rehashed) and impact another assignment
>>> (or even 'get'-access).
>> but wont the GIL be locked when the rehash occurs?
> 
> If there is a GIL then maybe yes.  But the GIL is an implementation
> detail.  It's not in Jython nor IronPython and maybe not forever in
> CPython.  Don't know about PyPy.

Just wondering.. Is this simply a case of defensive programming or is it
an error? (say, we're targeting only CPython).
For instance, what happens when there's dictionary key with a custom
__hash__ or __eq__ method?

Its probably wise to simply use a lock and relieve ourselves of the
burden of thinking about these cases. But it still is worth knowing...

Regards
Sreeram

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to