summaryrefslogtreecommitdiffstats
path: root/Demo/classes
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2003-04-24 16:59:45 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2003-04-24 16:59:45 (GMT)
commit64b3c830d44aaeac8de85067113b03bc62a92957 (patch)
tree364081117be8e6a48141a16c620bc6d8bbc3f262 /Demo/classes
parent91007e257201889d28a88b4f0802e8112a01e1bf (diff)
downloadcpython-64b3c830d44aaeac8de85067113b03bc62a92957.zip
cpython-64b3c830d44aaeac8de85067113b03bc62a92957.tar.gz
cpython-64b3c830d44aaeac8de85067113b03bc62a92957.tar.bz2
Avoid TypeError by not comparing complex numbers
Diffstat (limited to 'Demo/classes')
-rwxr-xr-xDemo/classes/Rat.py7
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()