On 08/04/13 20:45, Dave Angel wrote:

will always fail, since the integer 2 is not equal to the type int.  In Python 
2.x, when you compare objects of different types, you generally get unequal.  
(Exception, if you define your own classes, you can define how they compare to 
others)  In Python 3, you'd get an exception.


Not so. Equality testing is always allowed.

In Python 3:


py> 25 == "hello world"
False


exactly the same as in Python 2. It's only ordering comparisons, < <= >= > that 
raise an error with incompatible types:

py> 25 <= "hello world"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: int() <= str()



--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to