Dr. Phillip M. Feldman schrieb:
In [21]: x
Out[21]: [1, 2, 3, 5]

In [22]: x>6
Out[22]: True

Is this a bug?

In python2.x, it's the defined behavior - all types are somhow comparable. The comparison is stable (all lists compare larger to all ints), but of course this by no means well-defined.

This debatable design-decision has been remedied in Python3:

Python 3.1 (r31:73578, Jun 27 2009, 21:49:46)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> list(range(10)) < 10
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: list() < int()
>>>





Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to