Python: Why are some of Queue.queue's method "unreliable"?
multithreading, python, queue
Solution
Yes, the docs use "unreliable" here to convey exactly this meaning: for example, in a sense, `qsize` doesn't tell you how many entries there are "right now", a concept that is not necessarily very meaningful in a multithreaded world (except at specific points where synchronization precautions are being taken) -- it tells you how many entries it had "a while ago"... when you act upon that information, even in the very next opcode, the queue might have more entries, or fewer, or none at all maybe, depending on what other threads have been up to in the meantime (if anything;-).
Problem
In the `queue` class from the `Queue` module, there are a few methods, namely, `qsize`, `empty` and `full`, whose documentation claims they are "not reliable". What exactly is not reliable about them? I did notice that on the Python docs site, the following is said about `qsize`: Note, qsize() > 0 doesn’t guarantee that a subsequent get() will not block, nor will qsize() < maxsize guarantee that put() will not block. I personally don't consider that behavior "unreliable". But is this what is meant by "unreliable," or is there some more sinister defect in these methods?