Message152173
Nick Coghlan <report@bugs.python.org> wrote:
> Radical suggestion: make it public as collections.simple_ndarray?
Heh, that's a nice one. :)
While I think that the code in _testbuffer.c is sound and very well tested,
the API is low-level and optimized for testing all sorts of quirks.
Examples: _testbuffer.ndarray has the questionable capability of changing
views while buffers are exported. This is to test the pathological case
that came up in the discussion.
Then, similar to NumPy's ndarray, _testbuffer.ndarray constructs arrays
from a flat list. This is a bit clumsy but quite suitable for testing.
NumPy's ndarray is also the low level API. I think most people use
the high level array:
>>> a = array([[1,2], [3,4]], dtype="L")
>>> a
array([[1, 2],
[3, 4]], dtype=uint64)
So it would take some effort to polish the API.
Meanwhile, to eliminate the use of _testbuffer in the documentation, I think
the following might work:
I've just added complete support for displaying multi-dimensional lists and
multi-dimensional comparisons to memoryobject.c in my private repo.
The code is quite succinct and follows exactly the same pattern as
copy_base/copy_rec.
Then, in the documentation we can use cast() and memoryview.tolist(),
but add a comment that cast() is just used for demonstration purposes. |
|
Date |
User |
Action |
Args |
2012-01-28 17:19:18 | skrah | set | recipients:
+ skrah, teoliphant, paul.moore, mark.dickinson, ncoghlan, rupole, pitrou, kristjan.jonsson, vstinner, pv, jcon, petri.lehtinen |
2012-01-28 17:19:18 | skrah | set | messageid: <1327771158.38.0.886998726481.issue10181@psf.upfronthosting.co.za> |
2012-01-28 17:19:17 | skrah | link | issue10181 messages |
2012-01-28 17:19:17 | skrah | create | |
|