Tim Peters <t...@python.org> added the comment:

I'm sure Guido designed the API to discourage subtly bug-ridden code relying on 
the mistaken belief that it _can_ know the queue's current size.  In the 
general multi-threaded context Queue is intended to be used, the only thing 
`.qsize()`'s caller can know is that the queue _had_ the returned size at some 
time in the past.  It can't know what the size is at the time the returned 
value is used.

Note that the docstrings still say that the `.empty()` and `.full()` methods 
are "likely to be removed at some point".  The only surprise to me is that 
`.qsize()` doesn't also say that.  As is, I still see race-ridden code on 
StackOverflow from time to time using `.qsize()`.  There are already plenty of 
warnings about that in the docs.

----------
nosy: +tim.peters

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34180>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to