Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'binary': 0.07; 'imho.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; 'suggest': 0.14; 'agree.': 0.16; 'antoine': 0.16; 'bytes).': 0.16; 'choice,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:Problem': 0.16; 'wrote:': 0.18; '(in': 0.22; 'header :User-Agent:1': 0.23; 'asking': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'ideal': 0.29; "doesn't": 0.30; 'code': 0.31; 'object.': 0.31; 'writes:': 0.31; 'sense': 0.34; 'subject:with': 0.35; 'case,': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'returning': 0.36; 'thanks': 0.36; 'project': 0.37; 'to:addr:python-list': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'received:173': 0.61; 'afraid': 0.65; 'frank': 0.68; 'obvious': 0.74; 'antoine.': 0.84; 'improvement': 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Problem with psycopg2, bytea, and memoryview Date: Wed, 31 Jul 2013 13:59:20 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375293585 news.xs4all.nl 15984 [2001:888:2000:d::a6]:37752 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51679 On 7/31/2013 9:07 AM, Antoine Pitrou wrote: > Frank Millman 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