From: Andrew M. Kuchling Date: Thu, 24 Apr 2003 16:59:45 +0000 (+0000) Subject: Avoid TypeError by not comparing complex numbers X-Git-Tag: v2.3c1~1026 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64b3c830d44aaeac8de85067113b03bc62a92957;p=thirdparty%2FPython%2Fcpython.git Avoid TypeError by not comparing complex numbers --- diff --git a/Demo/classes/Rat.py b/Demo/classes/Rat.py index 4fc4a1786f1f..9e0c05d76ff7 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()