Martin Panter added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23756>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to