Eric Wieser <wieser.e...@gmail.com> added the comment:

> Revising the code example to use an empty array

I think you mean

>>> import array
>>> memoryview(array.array('H', [])).itemsize
2

Your example is an array containing 0, not an empty array - but the conclusion 
is the same.

> It is technically un-necessary as it can be obtained using 
> PyBuffer_SizeFromFormat

This obviously predicates on `PyBuffer_SizeFromFormat` being implemented, which 
according to the docs it is not.

> I think that the grammar would allow for an empty record "T{}" that would 
> have itemsize 0 but is of little use inside numpy.

It also allows for records of empty arrays, "T{(0)d:data:}". While these are of 
little use, they _are_ supported by both ctypes and numpy, so we should support 
them in the PEP3118 interface used between them.

----------
nosy: +Eric Wieser

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

Reply via email to