"Antoine Pitrou" <solip...@pitrou.net> wrote in message news:loom.20130731t150154-...@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 -- http://mail.python.org/mailman/listinfo/python-list