On Mon, 12 Oct 2015 17:15 Albert-Jan Roskam <sjeik_ap...@hotmail.com> wrote:

Hi,

In Python 2 one can do silly apple-pear comparisons such as 0> "0".*)
"CPython implementation detail: Objects of different types except numbers
are ordered by their type names; objects of the same types that don’t
support proper comparison are ordered by their address.". In Python3  this
has been fixed (it raises a TypeError). Is there a way to emulate this
behavior in Python 2?



Why do you want to? This kind of thing is nice to have when it's there by
default since it can help pick up errors. When it's not there that's
unfortunate which is why this was changed in Python 3 but it's not really
essential.

Most of the time you won't mix strings and ints unless it's a mistake. Are
you worried about making mistakes? Why not just test your code under Python
3 if so?

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

Reply via email to