Re: Problem with the default registration of the JSON adapter
От | Federico Di Gregorio |
---|---|
Тема | Re: Problem with the default registration of the JSON adapter |
Дата | |
Msg-id | 51ED4DDA.4090809@dndg.it обсуждение исходный текст |
Ответ на | Re: Problem with the default registration of the JSON adapter (Christophe Pettus <xof@thebuild.com>) |
Ответы |
Re: Problem with the default registration of the JSON adapter
|
Список | psycopg |
On 22/07/2013 17:02, Christophe Pettus wrote: > > On Jul 22, 2013, at 2:04 AM, Federico Di Gregorio wrote: >> IMO, dropping authomatic registration in the next minor release and >> having users explicitly calling register_json() is better. > > You don't have to register TEXT; why would you have to register JSON? Because with TEXT and DECIMAL and FLOAT and all the base types that have d direct 1-on-1 mapping to Python you don't have a choice. In more than 10 years of psycopg nobody ever asked «can I please get the floats as text instead of Python float objects?». JSON is different because the representation you get is exactly the representation you may want to send to the the client (probably over HTTP) and the conversion text->json objects->text uses quite a bit of cpu/memory. So it does make sense to make it either opt-in or opt-out. Given that psycopg never had opt-out adapters/typecasters my vote is to make it opt-in. federico
В списке psycopg по дате отправления: