Add a queue full()
API
#193
Closed
brendan-simon-indt
started this conversation in
Ideas
Replies: 2 comments
-
Looks like |
Beta Was this translation helpful? Give feedback.
0 replies
-
Done. See PR #194 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I notice there is a queue
empty()
API but not a queuefull()
API. Standard python queues have both, so thought it made sense to provide the same for persistent queues.I want to remove an item from the front of the queue if it is full before pushing a new item to the back of the queue - and do something with the old item that was removed. Basically, I'm using the queue is a FIFO of fixed size and what old items to pop off the end.
The
put()
API doesn't have a return value (e.g. a popped off item from a full queue), but that's consistent withqueue.Queue
, so I can't do an atomicput
andget
(if full). That's why thefull()
API would be handy (not that it's hard to explicitly test the queue size (pq.qsize() == pq.maxsize
)So would you consider adding the
full()
API or a PR to complement theempty()
API and make it consistent withqueue.Queue
?Beta Was this translation helpful? Give feedback.
All reactions