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

Niklas Norrthon niklas.norrthon at
Thu Sep 17 07:41:16 CEST 2009

On 17 Sep, 06:33, Steven D'Aprano
<ste... at> 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?
For one time sequences like files and generators your code is broken
for obvious reasons.

/Niklas Norrthon

More information about the Python-list mailing list