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

Guido van Rossum guido at python.org
Tue Oct 11 11:44:17 EDT 2016


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 support such a change.

On Tue, Oct 11, 2016 at 5:09 AM, Tarek Ziadé <tarek at ziade.org> wrote:
>
> 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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-ideas mailing list