comparison between non-comparable objects

Dave Angel d at
Tue Jan 8 07:03:30 CET 2013

On 01/08/2013 12:28 AM, Kelvin Li wrote:
> The language reference says:
> "...the choice whether one object [of built-in type] is considered
> smaller or larger than another one is made arbitrarily..."

When quoting some online source, please give a reference link. It took
me a while to find the following page with your quote in it:
   in section "6.9  Comparisons"

> but that seems to be Python 2 behavior; Python 3 apparently raises a
> TypeError. Does the documentation need updating?

That sentence is correct in context.  The bullet items there are labeled
"Comparison of objects of the same type..."  And the particular bullet
also qualifies the type of the two objects being compared:   " Most
other objects of built-in types..."

Earlier in the same section, it considers the case of comparing objects
of DIFFERENT type.

.... while the <, >, >= and <= operators raise a TypeError
<> when
comparing objects of different types that do not implement these
operators for the given pair of types....



More information about the Python-list mailing list