comparison between non-comparable objects

Kelvin Li ltwisabc at gmail.com
Tue Jan 8 02:53:50 EST 2013


> 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:
> 
> 
> http://docs.python.org/3.3/reference/expressions.html
> <http://docs.python.org/3.3/reference/expressions.htm>
>    in section "6.9  Comparisons"

Sorry about that. Thanks for finding the link.

> > 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..."

Got it, I was confusing built-in types with built-in functions--I
incorrectly thought object(), for example, returned an object of a
built-in type, and was behaving differently in Python 2 and 3:

object() < object()

Thanks,
Kelvin




More information about the Python-list mailing list