[issue3891] collections.deque should have empty() method

Roy Smith report at bugs.python.org
Sat Sep 20 05:22:10 CEST 2008


Roy Smith <roy at panix.com> added the comment:

I think you're missing the point.  Imagine you are somebody who doesn't know 
Python internals.  You're looking at the doc page for deque and ask yourself 
the question, "How do I tell if one of these is empty?".  There's no 
information ON THAT PAGE that answers that question.  Your explanation is all 
about "How do I compute the boolean value of a container?"  The logical gap 
is that you need to understand that to tell if it's empty, you should compute 
the boolean value.

You give the page on boolean operations as part of the answer, but you need 
to know to go look at that page in the first place.  I should be able to look 
at the page that describes a deque and find out everything I need to know 
about that class on that page.

Essentially, what you're saying is that deque inherits some behaviors from 
container, one of which being that if you convert a container to a bool, it 
is True iff the container is not empty.  So, there should be something on the 
deque page which points to that information.

Explicit is better than implicit :-)

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3891>
_______________________________________


More information about the Python-bugs-list mailing list