This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients porton, rhettinger, tim.peters, xtreak
Date 2018-07-22.18:37:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532284668.13.0.56676864532.issue34180@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-07-22 18:37:48tim.peterssetrecipients: + tim.peters, rhettinger, porton, xtreak
2018-07-22 18:37:48tim.peterssetmessageid: <1532284668.13.0.56676864532.issue34180@psf.upfronthosting.co.za>
2018-07-22 18:37:48tim.peterslinkissue34180 messages
2018-07-22 18:37:48tim.peterscreate