Re: Range type adaptation implemented
От | Daniele Varrazzo |
---|---|
Тема | Re: Range type adaptation implemented |
Дата | |
Msg-id | CA+mi_8aj57OP2BAtFi7210wN8FnQOGtXDVjVTDSKxj7QQiaYtQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Range type adaptation implemented (Jacob Kaplan-Moss <jacob@jacobian.org>) |
Список | psycopg |
On Mon, Sep 24, 2012 at 6:36 PM, Jacob Kaplan-Moss <jacob@jacobian.org> wrote: > 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. Good, with an hint about using postgres operators I think it would fit the bill. Thank you. -- Daniele
В списке psycopg по дате отправления: