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

Tarek Ziadé tarek at ziade.org
Tue Oct 11 08:09:49 EDT 2016


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 people think it's a good idea, I can add a ticket in the tracker and
try to provide a patch for the collections module maintainer.
If this was already talked about, or is a bad idea, sorry! :)

Cheers
Tarek
-- 

Tarek Ziadé | coding: https://ziade.org | running: https://foule.es |
twitter: @tarek_ziade


More information about the Python-ideas mailing list