New submission from Laurent Gautier <lgaut...@gmail.com>:
The buffer protocol is accounting for the row-major or column-major arrays, and that information is shown in the attributes, `c_contiguous` and `f_contiguous` respectively, of a memoryview object. Using the method `cast` allows one to specify a shape but does not allow to specify whether row or column major: ``` # column-major 3x2 array of bytes that was serialized b = bytearray([1,2,3,4,5,6]) mv = memoryview(b) mv_b = mv.cast('b', shape=(3,2)) ``` The result object is believed to be row-major and little can be done to correct it: ``` >>> mv_int.c_contiguous True >>> mv_int.c_contiguous = False AttributeError: attribute 'c_contiguous' of 'memoryview' objects is not writable ``` ---------- components: Interpreter Core messages: 326167 nosy: lgautier priority: normal severity: normal status: open title: Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve type: enhancement versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34778> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com