Remove redundant __nonzero__ methods
From https://docs.python.org/2/reference/datamodel.html#specialnames :
When this method is not defined, __len__() is called, if it is
defined, and the object is considered true if its result is nonzero.
Also helpful for an eventual migration to py3k, as __nonzero__ has been
replaced with __bool__, which also defaults to looking at __len__ if
undefined.
--- a/rset.py Fri May 23 18:12:47 2014 +0200
+++ b/rset.py Thu Apr 24 12:28:46 2014 +0200
@@ -112,9 +112,6 @@
"""returns the result set's size"""
return self.rowcount
- def __nonzero__(self):
- return self.rowcount
-
def __getitem__(self, i):
"""returns the ith element of the result set"""
return self.rows[i] #ResultSetRow(self.rows[i])
--- a/utils.py Fri May 23 18:12:47 2014 +0200
+++ b/utils.py Thu Apr 24 12:28:46 2014 +0200
@@ -169,8 +169,6 @@
id(self), self._item, self._size)
def __len__(self):
return self._size
- def __nonzero__(self):
- return self._size
def __iter__(self):
return repeat(self._item, self._size)
def __getitem__(self, index):