Re: Range type adaptation implemented
| От | Jacob Kaplan-Moss |
|---|---|
| Тема | Re: Range type adaptation implemented |
| Дата | |
| Msg-id | CAK8PqJFPruSzKXPjsntw5XziWGKp5XtmFSc9J6TVcg_1z3LRBQ@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Range type adaptation implemented (Daniele Varrazzo <daniele.varrazzo@gmail.com>) |
| Ответы |
Re: Range type adaptation implemented
|
| Список | 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 по дате отправления: