summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
diff options
context:
space:
mode:
authorJack Diederich <jackdied@gmail.com>2006-11-28 19:15:13 (GMT)
committerJack Diederich <jackdied@gmail.com>2006-11-28 19:15:13 (GMT)
commit4dafcc4ece09c2a60473bb109513de4e7d2c2b11 (patch)
tree32be8af9dd16e1ea407bf008c92d62f7cd7539bd /Lib/decimal.py
parentdfc9d4f7aa38a3961847c034532e39f05a569f54 (diff)
downloadcpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.zip
cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.gz
cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.bz2
- patch #1600346 submitted by Tomer Filiba
- Renamed nb_nonzero slots to nb_bool - Renamed __nonzero__ methods to __bool__ - update core, lib, docs, and tests to match
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r--Lib/decimal.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 99c0de6..4557e6a 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -633,14 +633,14 @@ class Decimal(object):
return other
return 0
- def __nonzero__(self):
+ def __bool__(self):
"""Is the number non-zero?
0 if self == 0
1 if self != 0
"""
if self._is_special:
- return 1
+ return True
return sum(self._int) != 0
def __cmp__(self, other, context=None):
@@ -759,7 +759,7 @@ class Decimal(object):
i = int(self)
if self == Decimal(i):
return hash(i)
- assert self.__nonzero__() # '-0' handled by integer case
+ assert self.__bool__() # '-0' handled by integer case
return hash(str(self.normalize()))
def as_tuple(self):