Problem with psycopg2, bytea, and memoryview
tjreedy at udel.edu
Wed Jul 31 19:59:20 CEST 2013
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.
"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
More information about the Python-list