Re: [Python-Dev] str(memoryview('abc')) != 'abc' in Python 2.7

2010-07-15 Thread Antoine Pitrou
On Thu, 15 Jul 2010 00:43:49 +0200 "M.-A. Lemburg" wrote: > Is this intended or should I open a bug report for it: > > >>> m = memoryview('abc') > >>> m == 'abc' > True > >>> str(m) == 'abc' > False > >>> str(m) > '' Well, I think this is intended. str(m) is the human-readable string representat

Re: [Python-Dev] str(memoryview('abc')) != 'abc' in Python 2.7

2010-07-15 Thread M.-A. Lemburg
Nick Coghlan wrote: > I wouldn't assume so - memoryview is meant to eventually support more > than just 1-D views of contiguous memory (see PEP 3118), so that > conversion doesn't seem intuitive to me. In the example I'm passing in a single dimension contiguous memory chunk to memoryview(), so in

Re: [Python-Dev] str(memoryview('abc')) != 'abc' in Python 2.7

2010-07-14 Thread Raymond Hettinger
On Jul 14, 2010, at 3:43 PM, M.-A. Lemburg wrote: > Is this intended or should I open a bug report for it: > m = memoryview('abc') m == 'abc' > True str(m) == 'abc' > False str(m) > '' > > I would have expected str(m) == 'abc'. That is also my expectation. A memoryview obj

Re: [Python-Dev] str(memoryview('abc')) != 'abc' in Python 2.7

2010-07-14 Thread Nick Coghlan
I wouldn't assume so - memoryview is meant to eventually support more than just 1-D views of contiguous memory (see PEP 3118), so that conversion doesn't seem intuitive to me. Cheers, Nick. -- Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia ___