Roy Smith <r...@panix.com> added the comment:

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.

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4680>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to