why (1, 2, 3) > [1, 2, 3] is true?
Stefan Behnel
stefan_ml at behnel.de
Thu Feb 25 08:46:56 EST 2010
fat bold cyclop, 25.02.2010 14:00:
> I tired to google for comparison of tuple to list but i failed.
>
> Could anyone explain it to me?
Both are not equal, so the comparison returns an arbitrary result in Py2.
Note that this was fixed in Py3:
Python 3.1.1+ (r311:74480, Nov 2 2009, 15:45:00)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> (1,2,3) > [1,2,3]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: tuple() > list()
Stefan
More information about the Python-list
mailing list