How smart are Semaphore Objects?

Tim Peters at
Wed Oct 31 06:49:02 CET 2001

[Matthew D. Wood]
> I firmly believe that when coding a function, object, program or
> whatever, one should assume that every other function, ... is either
> stupid or out to get you.  With this mind-set, I'm curious as to how
> (idiot or mean-person) proof semaphore objects are.

Not at all, nor are they intended to be, nor will they ever be.  The safest
synchronization gimmick in Python is in the std library:  see the docs for
the Queue class.  Second-safest is threading.Condition, when used as
intended.  Safest of all is to recompile Python without thread support.

but-event-that-won't-make-you-immune-to-anthrax<wink>-ly y'rs  - tim

More information about the Python-list mailing list