Slide 9
Slide 9 text
Comparing unorderable types
● In python3, TypeError is raised as warning if trying to compare unorderable
types
# Python 2.7.6
>>> print "[1, 2] > 'foo' = ", [1, 2] > 'foo'
[1, 2] > 'foo' = False
>>> print "(1, 2) > 'foo' = ", (1, 2) > 'foo'
(1, 2) > 'foo' = True
>>> print "[1, 2] > (1, 2) = ", [1, 2] > (1, 2)
[1, 2] > (1, 2) = False
# Python 3.6.5
>>> print("[1, 2] > 'foo' = ", [1, 2] > 'foo')
…
TypeError: unorderable types: list() > str()