Is python is fully thread safe

François Pinard pinard at iro.umontreal.ca
Sat Jul 24 17:10:40 CEST 2004


[Donn Cave]
> [Marco Aschwanden]
> > [Jon Perez]

> > > Someone please explain to me where is the wit in this...

> > Run the program if you can't see it and you will understand why it
> > has a problem with "threads" 8o)

> I believe he got that, but doesn't appreciate the humor behind it.  Oh
> well - ask a stupid question, get a stupid answer.

I did not closely follow the thread, but the `Subject:' line is not
stating a stupid question in my opinion.  On this list at least, to
questions like "Is this or that standard Python module thread-safe?", a
far too common reply is "Try it and you'll see...".

Well, bugs occurring out of lack of thread-safety might, in many
circumstances, hide for long before popping out, and hide again for long
afterwards.  They are not easy to reproduce.  "Testing reveals presence
of bugs, not their absence", as a proverb, is especially true in the
context of thread-safety.

Unless I'm missing a point (which is very possible), it does not seem
to me that Python documentation is especially collaborative at teaching
where threads are safe or not to use, so I'm left with the unpleasant
feeling that my threaded Python applications should (ideally) never be
allowed to go in real production.  It's OK if I'm the only one to suffer
from unexpected problems.

I would much like if Python documentation had more definite and
definitive answers about thread-safety of Python, everywhere.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard



More information about the Python-list mailing list