On 14-Jan-08, at 1:32 PM, Charles Merriam wrote: > Not to be pedantic, but the major concern others are voicing is that > is that queue size is not reliable and is therefore a potential source > of hard to find threading bugs by naive users. Why not just rename > q.size() to the unweildy name of q.est_size()?
This is a misleading name. The number returned from qsize() [not size ()] is perfectly reliable, in the sense that it is the exact size of the queue at some instant in time. The real concern is that qsize() > 0 doesn't guarantee that a subsequent .get() will not block, nor that qsize() < maxsize guarantee that .put() will not block. Incidentally, I find this warning much less confusion than the vague "Because of multithreading semantics, this number is not reliable." in the docs. -Mike _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
