diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2003-04-24 16:59:45 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2003-04-24 16:59:45 (GMT) |
commit | 64b3c830d44aaeac8de85067113b03bc62a92957 (patch) | |
tree | 364081117be8e6a48141a16c620bc6d8bbc3f262 /Demo/classes/Rat.py | |
parent | 91007e257201889d28a88b4f0802e8112a01e1bf (diff) | |
download | cpython-64b3c830d44aaeac8de85067113b03bc62a92957.zip cpython-64b3c830d44aaeac8de85067113b03bc62a92957.tar.gz cpython-64b3c830d44aaeac8de85067113b03bc62a92957.tar.bz2 |
Avoid TypeError by not comparing complex numbers
Diffstat (limited to 'Demo/classes/Rat.py')
-rwxr-xr-x | Demo/classes/Rat.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Demo/classes/Rat.py b/Demo/classes/Rat.py index 4fc4a17..9e0c05d 100755 --- a/Demo/classes/Rat.py +++ b/Demo/classes/Rat.py @@ -301,7 +301,12 @@ def test(): print complex(i) print for j in list: - print i + j, i - j, i * j, i / j, i ** j, cmp(i, j) + print i + j, i - j, i * j, i / j, i ** j, + if not (isinstance(i, ComplexType) or + isinstance(j, ComplexType)): + print cmp(i, j) + print + if __name__ == '__main__': test() |