Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51656
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'reason,': 0.07; 'versions,': 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; 'suggest': 0.14; 'wrote': 0.14; '*why*': 0.16; 'choice,': 0.16; 'equal.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'say.': 0.16; 'subject:Problem': 0.16; 'module': 0.19; 'server,': 0.19; 'example': 0.22; 'bytes': 0.24; 'example.': 0.24; 'compare': 0.26; 'post': 0.26; 'asking': 0.27; 'header:X-Complaints-To:1': 0.27; 'ideal': 0.29; "doesn't": 0.30; 'work.': 0.31; '>>>>': 0.31; 'writes:': 0.31; 'anyone': 0.31; 'text': 0.33; 'url:python': 0.33; 'sense': 0.34; 'subject:with': 0.35; 'but': 0.35; 'returning': 0.36; 'thanks': 0.36; "i'll": 0.36; 'url:org': 0.36; 'should': 0.36; 'example,': 0.37; 'project': 0.37; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'recent': 0.39; 'explain': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'above,': 0.60; 'full': 0.61; 'url:3': 0.61; 'more': 0.64; 'afraid': 0.65; 'frank': 0.68; 'results': 0.69; 'url:4': 0.69; 'skip:n 40': 0.81; 'antoine.': 0.84; 'blob': 0.84; 'improvement': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | "Frank Millman" <frank@chagford.com> |
| Subject | Re: Problem with psycopg2, bytea, and memoryview |
| Date | Wed, 31 Jul 2013 15:41:41 +0200 |
| References | <ktam8i$hj3$1@ger.gmane.org><loom.20130731T114936-455@post.gmane.org><ktat7p$t70$1@ger.gmane.org> <loom.20130731T150154-520@post.gmane.org> |
| X-Gmane-NNTP-Posting-Host | 197.87.30.34 |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.3790.4657 |
| X-RFC2646 | Format=Flowed; Original |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.3790.4913 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.25.1375278106.1251.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1375278106 news.xs4all.nl 15917 [2001:888:2000:d::a6]:38087 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:51656 |
Show key headers only | View raw
"Antoine Pitrou" <solipsis@pitrou.net> wrote in message news:loom.20130731T150154-520@post.gmane.org... > 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'll try it, and see what they say. > For example, the standard sqlite3 module returns bytes for BLOB columns, > and str for TEXT columns: > http://docs.python.org/3.4/library/sqlite3.html#introduction > >> Can anyone explain *why* the results do not compare equal? If I >> understood >> the problem, I might be able to find a workaround. > > Well, under recent Python versions, they should compare equal: > > Python 3.2.3 (default, Oct 19 2012, 19:53:16) > [GCC 4.7.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> memoryview(b"abc") == b"abc" > True > I am using Python 3.3.2. If I try your example above, it does work. However, for some reason, after a round-trip to the server, they do not compare equal. See my original post for a full example. Frank
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Problem with psycopg2, bytea, and memoryview "Frank Millman" <frank@chagford.com> - 2013-07-31 15:41 +0200
csiph-web