Stefan Krah <stefan-use...@bytereef.org> added the comment: Nick Coghlan <rep...@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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10181> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com