Message77989
I'm not actually sure what the use case is for clear(). It's easy
enough to just create a new deque. If you can do that, why do you need
clear()? Since I don't ever see a reason anybody would want to call
clear(), I'm not 100% if it should reset the high-water mark or not. I
don't *think* it should, but I'm willing to believe that a use case
could exist which would make me change my mind about that.
Popping all the elements off the deque certainly should *not* reset the
high water mark. The whole point of tracking the high water mark is to
know if the consumer thread ever fell behind the producer thread (yes, I
realize queues could be used for non-threading purposes). It's
perfectly normal for the queue to drain completely at times, and there's
absolutely no reason this should affect the high-water mark.
You do raise a good question about whether all of the standard
containers should be instrumented. I don't know the answer to that.
Queues and, say, dicts are different beasts. It's common to use queues
where the putting-in and taking-out are asynchronous, and thus the
high-water mark is an indicator of overall application health. I don't
see that for dicts, or lists (well, maybe if used as a stack) or most
other kinds of containers. |
|
Date |
User |
Action |
Args |
2008-12-17 22:05:46 | roysmith | set | recipients:
+ roysmith, rhettinger, pitrou, LambertDW |
2008-12-17 22:05:46 | roysmith | set | messageid: <1229551546.26.0.454791415763.issue4680@psf.upfronthosting.co.za> |
2008-12-17 22:05:45 | roysmith | link | issue4680 messages |
2008-12-17 22:05:44 | roysmith | create | |
|