diff options
author | Jack Diederich <jackdied@gmail.com> | 2006-11-28 19:15:13 +0000 |
---|---|---|
committer | Jack Diederich <jackdied@gmail.com> | 2006-11-28 19:15:13 +0000 |
commit | 4dafcc4ece09c2a60473bb109513de4e7d2c2b11 (patch) | |
tree | 32be8af9dd16e1ea407bf008c92d62f7cd7539bd /Demo | |
parent | Unit tests for PEP 3102, by Jiwon Seo. Forgot to add these earlier. (diff) | |
download | cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.gz cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.tar.bz2 cpython-4dafcc4ece09c2a60473bb109513de4e7d2c2b11.zip |
- 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 'Demo')
-rwxr-xr-x | Demo/classes/Complex.py | 2 | ||||
-rwxr-xr-x | Demo/classes/Rat.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Demo/classes/Complex.py b/Demo/classes/Complex.py index a77989750f9..2019cdf32d9 100755 --- a/Demo/classes/Complex.py +++ b/Demo/classes/Complex.py @@ -165,7 +165,7 @@ class Complex: other = ToComplex(other) return cmp(other, self) - def __nonzero__(self): + def __bool__(self): return not (self.re == self.im == 0) abs = radius = __abs__ diff --git a/Demo/classes/Rat.py b/Demo/classes/Rat.py index 55543b6d2d2..24670b616b3 100755 --- a/Demo/classes/Rat.py +++ b/Demo/classes/Rat.py @@ -223,7 +223,7 @@ class Rat: return cmp(Rat(a), b) # a != 0 - def __nonzero__(a): + def __bool__(a): return a.__num != 0 # coercion |