Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36415

Re: comparison between non-comparable objects

Date 2013-01-08 01:03 -0500
From Dave Angel <d@davea.name>
Subject Re: comparison between non-comparable objects
References <1357622887.2914.29.camel@qm>
Newsgroups comp.lang.python
Message-ID <mailman.262.1357625026.2939.python-list@python.org> (permalink)

Show all headers | View raw


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:


http://docs.python.org/3.3/reference/expressions.html
<http://docs.python.org/3.3/reference/expressions.htm>
   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
<http://docs.python.org/3.3/library/exceptions.html#TypeError> when
comparing objects of different types that do not implement these
operators for the given pair of types....


-- 

DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: comparison between non-comparable objects Dave Angel <d@davea.name> - 2013-01-08 01:03 -0500

csiph-web