[Python-Dev] Making Queue.Queue easier to use (original) (raw)
Josiah Carlson jcarlson at uci.edu
Tue Oct 11 20:07:24 CEST 2005
- Previous message: [Python-Dev] Making Queue.Queue easier to use
- Next message: [Python-Dev] Making Queue.Queue easier to use
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum <guido at python.org> wrote:
> Optionally, the existing "put" and "get" methods could be deprecated, with the > goal of eventually changing their signature to match the putwait and getwait > methods above.
Apart from trying to guess the API without reading the docs (:-), what are the use cases for using put/get with a timeout? I have a feeling it's not that common.
With timeout=0, a shared connection/resource pool (perhaps DB, etc., I use one in the tuple space implementation I have for connections to the tuple space). Note that technically speaking, Queue.Queue from Pythons prior to 2.4 is broken: get_nowait() may not get an object even if the Queue is full, this is caused by "elif not self.esema.acquire(0):" being called for non-blocking requests. Tim did more than simplify the structure by rewriting it, he fixed this bug.
With block=True, timeout=None, worker threads pulling from a work-to-do queue, and even a thread which handles the output of those threads via a result queue.
- Josiah
- Previous message: [Python-Dev] Making Queue.Queue easier to use
- Next message: [Python-Dev] Making Queue.Queue easier to use
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]