[docs] Queue.PriorityQueue

Feldman, Phillip M (AS) phillip.m.feldman at ngc.com
Wed Sep 10 00:31:09 CEST 2014


I’d like to propose a rewording of the documentation for Queue.qsize() in line with Robert’s explanation below.

Phillip

From: Engineering Support (Enthought Premium Support) [mailto:epd.gold at enthought.com]
Sent: Sunday, August 24, 2014 9:59 AM
To: Feldman, Phillip M (AS)
Subject: EXT :Re: Queue.PriorityQueue

##- Please type your reply above this line -##

Your request (# 36243) has been solved.

To reopen this request, reply to this email or click this link:
http://support.enthought.com/requests/36243 (requires Enthought subscriber login)

Engineering Support (Enthought)

Aug 24 11:59

In single-threaded use, it is perfectly exact. In multi-threaded use, it is exact only while qsize() holds the lock, which it releases just before it returns. It is possible that the interpreter may switch to another thread right after the lock is released but before your code receives the value. That other thread may change the size of the queue.

Robert Kern




Phillip Feldman

Aug 24 00:48

From time to time I used Queue.PriorityQueue. It appears to work well, but I’m concerned about the following (from https://docs.python.org/2/library/queue.html):

Queue.qsize()

Return the approximate size of the queue.

I wonder why this returns the approximate size of the queue, and whether there is a way to get the exact size.

Phillip


This email is a service from Enthought. Delivered by Zendesk<http://www.zendesk.com>.
Message-Id:31KJ5MQM_53fa19d650ba6_21f03fd7632b332c79721_sprut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20140909/90bcb6a0/attachment.html>


More information about the docs mailing list