Skip to main content

Sometimes when you use the Queue class in Python, you need to get an item from any of several queues. This small module implements an easy solution for this problem.

Project description

Sometimes when you use the Queue class in Python, you need to get an item from any of several queues. This small module implements an easy solution for this problem.

MultiQueue class inherits from Queue and overrides internal methods of data access, sharing its interface but managing multiple queues instead of one.

To add items to a MultiQueue, the put method must receive a tuple with the identifier of the queue as the first element and the value to be stored as the second element.

When getting an item from a MultiQueue, you get a tuple indicating from which queue has been extracted and the extracted value. If there are items in multiple queues, these are obtained mixed, as applying the Round Robin algorithm.

Furthermore, when instantiating the MultiQueue is possible to assign different weights to the queues, so that some have higher priority over others. If you have 2 queues in a MultiQueue, with weights 1 and 10 and both with a large number of elements, in 11 calls to get method you will obtain just one element from the first queue and 10 elements from the second.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multiqueue-0.1.6.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file multiqueue-0.1.6.tar.gz.

File metadata

  • Download URL: multiqueue-0.1.6.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for multiqueue-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ae97cae508a675341188eca80ff94c6ebc8f52a87a713333ce80d6a5b1237be5
MD5 e546b8a0c0ad006f95c38d0f66e45e4d
BLAKE2b-256 aac1c1ee76998785d70d0972891340f0c2a22aacaf14aa0322f2c0cb174e0bca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page