[issue3891] collections.deque should have empty() method
Roy Smith
report at bugs.python.org
Thu Sep 18 05:14:29 CEST 2008
Roy Smith <roy at panix.com> added the comment:
In retrospect, it's obvious that "while mydeque" is indeed the way to
process the queue, yet, when I was reading the docs, I didn't come away
with that.
The statement, "list objects support similar operations", is wishy-washy.
It is not the same as saying "deque is a subclass of list" (which isn't
true), nor "the set of operations supported by deque is a superset of
those supported by list" (which also isn't true). Thus, you're left
having to interpret the statement as a handwave that deques are sort-of
list-like things, with some (indeterminate) set of operations in common.
It's not at all obvious (or at least it wasn't to me) that one of those
operations is evaluating the container in a boolean context to test for
emptiness.
Anyway, to more concretely answer your question, I'd just make the plain
statement, "An empty deque evaluates as false", somewhere right on the
page where the methods are listed.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3891>
_______________________________________
More information about the Python-bugs-list
mailing list