summaryrefslogtreecommitdiff
path: root/Demo
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2003-04-24 16:59:45 +0000
committerAndrew M. Kuchling <amk@amk.ca>2003-04-24 16:59:45 +0000
commit3ef1894bf1cb15b4e84912d8aecbfa442aa75c59 (patch)
tree9ec006bede3fdaf46475b64d58d2f51a94332f75 /Demo
parent81bc661701f31611eca8b4dc5326fb186b887f19 (diff)
downloadcpython-3ef1894bf1cb15b4e84912d8aecbfa442aa75c59.tar.gz
Avoid TypeError by not comparing complex numbers
Diffstat (limited to 'Demo')
-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 4fc4a1786f..9e0c05d76f 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()