Stefan Krah added the comment: Martin v. L??wis <rep...@bugs.python.org> wrote: > Here is a more formal definition of my last proposal, > > v and w are equal iff > v.shape() == w.shape() and > ((v.format == w.format and v.tobytes() == w.tobytes()) or > v.tolist() == w.tolist()) > if tolist raises an exception for unsupported codes, they are not equal
This wouldn't solve the NaN problem though: >>> nd = ndarray([(1,2)], shape=[1], format='dd', flags=ND_WRITABLE) >>> nd[0] = (float('nan'), float('nan')) >>> m = memoryview(nd) >>> m == nd True What's the policy on importing modules in the Object/* hierarchy? Can we import _struct? The current unpack_cmp() function for identical single native format codes is very fast. The only thing that would be needed to make it general is to replace default: return -1; with default: return unpack_cmp_struct(); The code is already there in _testbuffer.c. _testbuffer.c itself has 100% code coverage (including all error conditions with a special patch). This means that all tests are already present in test_buffer.py. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15573> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com