Stefan Krah added the comment: The ideal specification is:
1) Arrays v and w are equal iff format and shape are equal and for all valid indices allowed by shape memcmp((char *)PyBuffer_GetPointer(v, indices), (char *)PyBuffer_GetPointer(w, indices), itemsize) == 0. 2) Two format strings s and t are equal if canonical(s) == canonical(t). End ideal specification. Purely to *facilitate* the implementation of a format comparison function, I suggested: 3) An exporter must initialize the format field of a Py_buffer structure with canonical(s). If *all* exporters obey 3), a format comparison function can simply call strcmp(s, t) (after sorting out the byte order specifier). Specifically, if x and y are equal, then: a) x == memoryview(x) == memoryview(y) == y If x and y are equal and exporter x does *not* obey 3), but exporter y does, then: b) x == memoryview(x) != memoryview(y) == y Under rule 3) this would be the fault of exporter x. For Python 3.3 it is also possible to state only 1) and 2), with a caveat in the documentation that case b) might occur until the format comparison function in memoryview implements the reductions to canonical forms. The problem is that reductions to canonical forms might get very complicated if #3132 is implemented. ---------- _______________________________________ 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