Skip to content
Snippets Groups Projects
Commit b4e63bd2 authored by Dave Shawley's avatar Dave Shawley
Browse files

Results: add __bool__ method.

Python 3 dropped __nonzero__ in preference to __bool__.  The code was
only working because they fall back to __len__ if __bool__ is not
implemented.  This commit adds a __bool__ implementation that simply
calls __nonzero__.
parent 7b3d14f9
No related branches found
No related tags found
No related merge requests found
Version History
===============
- Next Release
- Implement ``Results.__bool__`` to be explicit about Python 3 support.
- 1.10.3 2017-11-01
- Remove the functionality from ``TornadoSession.validate`` and make it raise a ``DeprecationWarning``
- Catch the ``KeyError`` raised when ``PoolManager.clean()`` is invoked for a pool that doesn't exist
Loading
Loading
Loading
Loading
@@ -59,6 +59,9 @@ class Results(object):
def __nonzero__(self):
return bool(self.cursor.rowcount)
 
def __bool__(self):
return self.__nonzero__()
def __repr__(self):
return '<queries.%s rows=%s>' % (self.__class__.__name__, len(self))
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment