Re: comparison on list yields surprising result

2009-08-29 Thread Steven D'Aprano
On Sat, 29 Aug 2009 09:36:38 +0200, Hendrik van Rooyen wrote: > On Friday 28 August 2009 21:00:31 Dr. Phillip M. Feldman wrote: >> In [21]: x >> Out[21]: [1, 2, 3, 5] >> >> In [22]: x>6 >> Out[22]: True >> >> Is this a bug? > > No, it is a feature, so that you can use sorted on this: > > [[1,2,3

Re: comparison on list yields surprising result

2009-08-29 Thread Hendrik van Rooyen
On Friday 28 August 2009 21:00:31 Dr. Phillip M. Feldman wrote: > In [21]: x > Out[21]: [1, 2, 3, 5] > > In [22]: x>6 > Out[22]: True > > Is this a bug? No, it is a feature, so that you can use sorted on this: [[1,2,3,4,5],6] - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison on list yields surprising result

2009-08-28 Thread Dr. Phillip M. Feldman
It looks as though what I should have done is the following: In [23]: array(x) > 6 Out[23]: array([False, False, False, False], dtype=bool) -- View this message in context: http://www.nabble.com/comparison-on-list-yields-surprising-result-tp25195170p25195893.html Sent from the Python - pyt

Re: comparison on list yields surprising result

2009-08-28 Thread Diez B. Roggisch
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.

Re: comparison on list yields surprising result

2009-08-28 Thread Diez B. Roggisch
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.

Re: comparison on list yields surprising result

2009-08-28 Thread John Machin
On Aug 29, 5:00 am, "Dr. Phillip M. Feldman" wrote: > In [21]: x > Out[21]: [1, 2, 3, 5] > > In [22]: x>6 > Out[22]: True > > Is this a bug? No. http://docs.python.org/reference/expressions.html#notin -- http://mail.python.org/mailman/listinfo/python-list

comparison on list yields surprising result

2009-08-28 Thread Dr. Phillip M. Feldman
In [21]: x Out[21]: [1, 2, 3, 5] In [22]: x>6 Out[22]: True Is this a bug? -- View this message in context: http://www.nabble.com/comparison-on-list-yields-surprising-result-tp25195170p25195170.html Sent from the Python - python-list mailing list archive at Nabble.com. -- h