Avoid TypeError by not comparing complex numbers

This commit is contained in:
Andrew M. Kuchling 2003-04-24 16:59:45 +00:00
parent 91007e2572
commit 64b3c830d4
1 changed files with 6 additions and 1 deletions

View File

@ -301,7 +301,12 @@ def test():
print complex(i) print complex(i)
print print
for j in list: 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__': if __name__ == '__main__':
test() test()