Dictionaries and Threads

Aahz Maruch aahz at netcom.com
Fri May 26 20:21:40 CEST 2000


In article <392ebd70$0$18389 at personalnews.de.uu.net>,
Johannes Stezenbach <yawyi at gmx.de> wrote:
>Aahz Maruch <aahz at netcom.com> wrote:
>>
>>Note very carefully, though, that map() and reduce() are not
>>thread-safe.
>
>Why not? The global interpreter lock isn't released in the code of
>builtin_map() or builtin_reduce(), so no other thread can change the
>sequence while the map/reduce loop is running.

IIRC, the global interpreter lock can get released when the function
gets called; it's possible that the lock can't get released if the
function is a built-in.  In any event, my statement that map() and
reduce() (and also filter()) are not by definition thread-safe stands.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Yes, but would you kick any of them out of bed?"
"That depends: do we have to do anything with them in the bed, or
are they just in the bed?" -- AM/SJM



More information about the Python-list mailing list