Re: Range type adaptation implemented - Mailing list psycopg

From Jacob Kaplan-Moss
Subject Re: Range type adaptation implemented
Date
Msg-id CAK8PqJFPruSzKXPjsntw5XziWGKp5XtmFSc9J6TVcg_1z3LRBQ@mail.gmail.com
Whole thread Raw
In response to Re: Range type adaptation implemented  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Responses Re: Range type adaptation implemented
List psycopg
On Mon, Sep 24, 2012 at 11:44 AM, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
> We could return False to any comparison but still it's not like "you
> cannot do that, mate". Anybody knows an example of unorderable object
> in Python? Is there anything more appropriate than throwing TypeError?

I'd say take a cue from how Python 3 handles trying to compare disparate types:

    $ python3
    Python 3.2.2 (default, Feb 23 2012, 12:57:05)
    [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.45)] on darwin
    >>> {} < []
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unorderable types: dict() < list()

So I'd say TypeError is correct, perhaps with a message like
"unorderable type: range()" or something.

Jacob


psycopg by date:

Previous
From: Daniele Varrazzo
Date:
Subject: Re: Range type adaptation implemented
Next
From: Daniele Varrazzo
Date:
Subject: Re: Range type adaptation implemented