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 roysmith
Recipients LambertDW, pitrou, rhettinger, roysmith
Date 2008-12-17.19:49:50
SpamBayes Score 0.000116415
Marked as misclassified No
Message-id <>
I'm suppose you could implement this in a subclass, but it would be
inefficient.  You'd have to over-ride put() and get(), call qsize(),
then delegate to Base.put() and Base.get().

A cleaner solution would be in the C implementation of deque, in
Modules/collectionsmodule.c.  There's just a couple of places where
queue->len gets incremented.  All that needs to happen is add:

if (queue->len > queue->high_water_mark) {
    queue->high_water_mark = queue->len;

after each one and then add the appropriate accessor functions in deque
and Queue to expose it to users.  The run-time cost is a couple of
machine instructions for each item added to the deque.

If I were to write the code and submit it, would you be willing to
accept it?
Date User Action Args
2008-12-17 19:49:52roysmithsetrecipients: + roysmith, rhettinger, pitrou, LambertDW
2008-12-17 19:49:52roysmithsetmessageid: <>
2008-12-17 19:49:51roysmithlinkissue4680 messages
2008-12-17 19:49:50roysmithcreate