[issue5231] Change format of a memoryview

2012-02-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3f9b3b6f7ff0 by Stefan Krah in branch 'default': - Issue #10181: New memoryview implementation fixes multiple ownership http://hg.python.org/cpython/rev/3f9b3b6f7ff0 -- nosy: +python-dev ___ Python track

[issue5231] Change format of a memoryview

2012-01-29 Thread Stefan Krah
Stefan Krah added the comment: Yes, it's really superseded by #10181 now. I'm closing as 'duplicate', since technically it'll be fixed once the patch for #10181 is committed. -- dependencies: -Problems with Py_buffer management in memoryobject.c (and elsewhere?) resolution: -> duplic

[issue5231] Change format of a memoryview

2012-01-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Shouldn't this be closed in favour of #10181? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue5231] Change format of a memoryview

2011-09-08 Thread Stefan Krah
Stefan Krah added the comment: The cast method is completely implemented over at #10181. -- dependencies: +Problems with Py_buffer management in memoryobject.c (and elsewhere?) ___ Python tracker _

[issue5231] Change format of a memoryview

2011-08-23 Thread Stefan Krah
Stefan Krah added the comment: Nick Coghlan wrote: > So I agree with Victor that 1-D bytes -> any shape/format and any > shape/format -> 1-D bytes should be allowed, but I think we should > hold off on allowing arbitrary transformations in a single step. 1-D bytes -> any shape/format would wor

[issue5231] Change format of a memoryview

2011-08-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: > However, requiring an explicit two-step process for any other casting > (i.e. take a 1-D view, then a shaped view of that flat 1-D view) also > sounds reasonable. > > So I agree with Victor that 1-D bytes -> any shape/format and any > shape/format -> 1-D byte

[issue5231] Change format of a memoryview

2011-08-23 Thread Nick Coghlan
Nick Coghlan added the comment: Casting to a flat 1-D array of bytes is reasonable (it's essentially saying 'look, just give me the raw data, it's on my own head if I stuff up the formatting'). However, requiring an explicit two-step process for any other casting (i.e. take a 1-D view, then

[issue5231] Change format of a memoryview

2011-08-23 Thread Stefan Krah
Stefan Krah added the comment: Rethinking a bit: Casting to arbitrary formats might go a bit far. Currently, the combination (format=NULL, shape=NULL) can serve as a warning "This buffer has been cast to unsigned bytes". If we allow casts from bytes to int32, we'll have (format="i", shape=x) a

[issue5231] Change format of a memoryview

2011-08-23 Thread Stefan Krah
Stefan Krah added the comment: Good, I'll use 'format'. I was mainly worried about the shadowing issue. -- ___ Python tracker ___ ___

[issue5231] Change format of a memoryview

2011-08-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Hmm, indeed. How about: > > 1) memoryview(a, format='B') > > Shadows a builtin function; annoying syntax highlighting in current Vim. > > 2) memoryview(a, fmt='B') > > I'm fully expecting a comment about 'strpbrk' again, but I like it. :) I really prefer

[issue5231] Change format of a memoryview

2011-08-23 Thread Stefan Krah
Stefan Krah added the comment: Antoine Pitrou wrote: > > Or go all the way and make memoryview take any flag: > > > > a = array.array('i', [1,2,3]) > > m = memoryview(a, getbuf=PyBUF_SIMPLE) > > This is good for testing, but Python developers shouldn't have to know > about the low-level flags

[issue5231] Change format of a memoryview

2011-08-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Or go all the way and make memoryview take any flag: > > a = array.array('i', [1,2,3]) > m = memoryview(a, getbuf=PyBUF_SIMPLE) This is good for testing, but Python developers shouldn't have to know about the low-level flags. -- ___

[issue5231] Change format of a memoryview

2011-08-23 Thread Stefan Krah
Stefan Krah added the comment: I think this would be useful and I'll try it out in features/pep-3118#memoryview. Syntax options that I'd prefer: a = array.array('i', [1,2,3]) m = memoryview(a, 'B') Or go all the way and make memoryview take any flag: a = array.array('i', [1,2,3]) m = memor

[issue5231] Change format of a memoryview

2011-06-20 Thread John O'Connor
Changes by John O'Connor : -- nosy: +jcon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org

[issue5231] Change format of a memoryview

2011-05-14 Thread Mark Dickinson
Mark Dickinson added the comment: Unassigning. Sorry; no time for this at the moment. -- ___ Python tracker ___ ___ Python-bugs-list

[issue5231] Change format of a memoryview

2011-05-14 Thread Mark Dickinson
Changes by Mark Dickinson : -- assignee: mark.dickinson -> ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue5231] Change format of a memoryview

2011-05-09 Thread STINNER Victor
STINNER Victor added the comment: Read a int32 array as a raw byte string is useful, but the opposite is also useful. -- nosy: +haypo ___ Python tracker ___

[issue5231] Change format of a memoryview

2011-05-09 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- stage: patch review -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5231] Change format of a memoryview

2011-05-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: In the mean time I had to resort to dirty hacks in 1ac03e071d65 (such as using io.BytesIO.write(), which I know is implemented in C and doesn't care about item size). At the minimum, a memoryview.getflatview() function would be nice (and probably easier to c

[issue5231] Change format of a memoryview

2011-02-13 Thread Nick Coghlan
Nick Coghlan added the comment: It is, but keep issue 10181 in mind (since that may lead to some restructuring of the memoryview code, potentially leading to a need to update your patch). -- ___ Python tracker ___

[issue5231] Change format of a memoryview

2011-02-13 Thread Xuanji Li
Xuanji Li added the comment: Is this issue from 2 years ago still open? I checked the docs and it seems to be. If it is, I would like to work on a patch and submit it soon. -- ___ Python tracker _

[issue5231] Change format of a memoryview

2011-02-13 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/m

[issue5231] Change format of a memoryview

2011-01-03 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- assignee: -> mark.dickinson nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue5231] Change format of a memoryview

2010-08-08 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- stage: -> unit test needed versions: +Python 3.2 -Python 3.1 ___ Python tracker ___ ___ Python-bugs-lis

[issue5231] Change format of a memoryview

2009-02-12 Thread Gregory P. Smith
Gregory P. Smith added the comment: Agreed, this would be useful. See http://codereview.appspot.com/12470/show if anyone doesn't believe us. ;) ___ Python tracker ___ _

[issue5231] Change format of a memoryview

2009-02-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: (Another way to see it is as supplying a Python equivalent to the C buffer API, with access to the raw Py_buffer) ___ Python tracker ___

[issue5231] Change format of a memoryview

2009-02-12 Thread Antoine Pitrou
New submission from Antoine Pitrou : Memoryview objects provide a structured view over a memory area, meaning the length, indexing and slicing operations respect the itemsize: >>> import array >>> a = array.array('i', [1,2,3]) >>> m = memoryview(a) >>> len(a) 3 >>> m.itemsize 4 >>> m.format 'i'