why (1, 2, 3) > [1, 2, 3] is true?

Richard Thomas chardster at gmail.com
Thu Feb 25 09:21:56 EST 2010


On Feb 25, 2:03 pm, fat bold cyclop <fat.bold.cyc... at gmail.com> wrote:
> > Both are not equal, so the comparison returns an arbitrary result in Py2.
>
> Thanks, Stefan. If I understand you correctly the comparison is not
> valid.
> But I wonder if there is any logic behind this (in 2.x).
> Is it possible to predict result of this comparison?
>
> Thanks again,
> fbc

I believe in 2.x they are ordered by the names of their types but I
could be wrong.

1 < [] < '' < () < u''



More information about the Python-list mailing list