Re: [Python-ideas] Adding full() to collections.deque

2016-10-11 Thread Tarek Ziadé
Ah! I havn't thought about that because in my use case the deque is append-only so once it's full it discards older elements. I guess what I really need is a regular FIFO Queue Thanks for the feedback ! -- Tarek Ziadé | coding: https://ziade.org | running: https://foule.es | twitter: @tarek_

Re: [Python-ideas] Adding full() to collections.deque

2016-10-11 Thread Guido van Rossum
Isn't the problem that you don't know if it's still full on the next line? After all you supposedly have a multi-threaded app here, otherwise why bother with any of that? Or maybe you can describe the real-world use case where you wanted this in more detail? Without much more evidence I can't suppo

[Python-ideas] Adding full() to collections.deque

2016-10-11 Thread Tarek Ziadé
Hey, When creating deque instances using a value for maxlen, it would be nice to have a .full() method like what Queue provides, so one may do: my_deque = deque(maxlen=300) if my_deque.full(): do_something() instead of doing: if len(my_deque) == my_deque.maxlen: do_something() If peopl