What kind of "thread safe" are deque's actually?

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Mar 29 01:54:06 EDT 2023


On 28/03/23 2:25 pm, Travis Griggs wrote:
> Interestingly the error also only started showing up when I switched from running a statistics.mean() on one of these, instead of what I had been using, a statistics.median(). Apparently the kind of iteration done in a mean, is more conflict prone than a median?

It may be a matter of whether the GIL is held or not. I had a look
at the source for deque, and it doesn't seem to explicitly do
anything about locking, it just relies on the GIL.

So maybe statistics.median() is implemented in C and statistics.mean()
in Python, or something like that?

-- 
Greg


More information about the Python-list mailing list