Python doesn't worry about a precise boolean object, it
distinguishes between something and nothing.
Is there anything left?" is a pretty good analogy for iterators.
It isn't always cheaply available, and having might
encourage poor style -- so iterators are going back
to the default for non-containers of always True.
How general strong is this default-to-true rule?
If I submit a documentation patch, should I say that
numbers, lists, strings, dictionaries, and tuples are
a special case, or should I just warn that some
container-like objects (including iterators) are always
True?
More specific question:
A Queue.Queue is always true. Should I submit a
bug patch or add it as a beware of custom classes
example?
def __nonzero__(self):
return not self.empty()
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com