Message239851
I will to pull the stdtypes.rst changes out into a separate patch and issue, if that will make review easier. I think they are an improvement because the previous version was incorrect and misleading, but they are probably not necessary for people to understand what a C-contiguous bytes-like object is.
I don’t think “flattened length” is explicitly defined anywhere, but it is already used in the memoryview() documentation and elsewhere. I took it to mean the number of elements in the nested list, if you ignore the fact that it is nested; i.e. ignore the extra "[" and "]" delimiters in the repr(), and just count the other values inside them.
The reason for defining C-contiguous was that I originally understood “contiguous” to be much more general than what seems to be meant. I assumed both memoryview(contiguous)[::-1] and a 2×2×2 array with stride=[4, 1, 2] would be contiguous, although neither have the C or Fortran array layout.
I think we need to define C-contiguous well enough for people to understand which standard Python objects are bytes-like objects. Maybe not Fortran-contiguous, because it doesn’t seem relevant to standard Python objects. Considering Serhiy asked if array.array() is always C-contiguous, I may not have done enough to explain that. (I think the answer is always yes.)
David: If a Fortran array was allowed in a bytes-like context without memory copying, the order of the array elements would differ from the order returned by the meoryview.tobytes() method, which essentially is defined to copy them out in C-array or flattend-tolist() order. |
|
Date |
User |
Action |
Args |
2015-04-01 21:37:21 | martin.panter | set | recipients:
+ martin.panter, pitrou, ezio.melotti, r.david.murray, skrah, docs@python, serhiy.storchaka |
2015-04-01 21:37:20 | martin.panter | set | messageid: <1427924240.96.0.560182650627.issue23756@psf.upfronthosting.co.za> |
2015-04-01 21:37:20 | martin.panter | link | issue23756 messages |
2015-04-01 21:37:20 | martin.panter | create | |
|