Message326167
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
``` |
|
Date |
User |
Action |
Args |
2018-09-23 17:51:38 | lgautier | set | recipients:
+ lgautier |
2018-09-23 17:51:38 | lgautier | set | messageid: <1537725098.47.0.956365154283.issue34778@psf.upfronthosting.co.za> |
2018-09-23 17:51:38 | lgautier | link | issue34778 messages |
2018-09-23 17:51:38 | lgautier | create | |
|