Fw: Problem with psycopg2, bytea, and memoryview

Поиск
Список
Период
Сортировка
От Frank Millman
Тема Fw: Problem with psycopg2, bytea, and memoryview
Дата
Msg-id 25EDB20679154BDBB3CBBD335184E1D7@frank
обсуждение исходный текст
Ответы Re: Fw: Problem with psycopg2, bytea, and memoryview  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
Hi all

I recently posted about a problem I was having with psycopg2 returning a
'memoryview' for bytea objects. Daniele Varrazzo very kindly gave me an
effective workaround.

I had previously asked the question on the python mailing list. Among other
replies, I received the following comment. I felt that I should forward it
to this list, but I am passing it on for information only. I have no
personal opinion on the matter.

----- Original Message -----
From: "Terry Reedy" <tjreedy@udel.edu>
Newsgroups: gmane.comp.python.general
To: <python-list@python.org>
Sent: Wednesday, July 31, 2013 7:59 PM
Subject: Re: Problem with psycopg2, bytea, and memoryview


> On 7/31/2013 9:07 AM, Antoine Pitrou wrote:
>> Frank Millman <frank <at> chagford.com> writes:
>>>
>>> Thanks for that, Antoine. It is an improvement over tobytes(), but i am
>>> afraid it is still not ideal for my purposes.
>>
>> I would suggest asking the psycopg2 project why they made this choice,
>> and
>> if they would reconsider. Returning a memoryview doesn't make much sense
>> IMHO.
>
> I agree.
> "memoryview objects allow Python code to access the internal data of an
> object that supports the buffer protocol without copying."
> Example: the binary image data of an image object.
> They are not intended to be a standalone objects when there is an obvious
> alternative (in this case, bytes).
>
> --
> Terry Jan Reedy
>

Thanks

Frank Millman



В списке psycopg по дате отправления:

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Re: Problem with memoryview
Следующее
От: "Frank Millman"
Дата:
Сообщение: Re: Problem with memoryview