Are min() and max() thread-safe?

Steven D'Aprano steven at
Thu Sep 17 06:39:12 CEST 2009

On Thu, 17 Sep 2009 04:33:05 +0000, Steven D'Aprano wrote:

> I have two threads, one running min() and the other running max() over
> the same list. I'm getting some mysterious results which I'm having
> trouble debugging. Are min() and max() thread-safe, or am I doing
> something fundamentally silly by having them walk over the same list
> simultaneously?
> My code is as follows. Is there anything obviously wrong with it?

For clarity, I'm not (yet) asking for help debugging the errors I'm 
getting -- if I were, I would post a minimal example and a traceback. I'm 
just looking for reassurance that I'm not being an idiot for even 
attempting what I'm doing.

Thank you.


More information about the Python-list mailing list