Hi,
to share data, a number of libraries use the buffer protocol(s)[
0].
There seems to be a python issue open [
1], and a typing issue open [
2].
Anyone have better interim solution(s) that work cross-library?
The given work-around in [
2] doesn't really work in a number of cases:
Union[bytes, bytearray, memoryview]
Consider if this would work with array.array, or <type 'numpy.ndarray'> or dozens of other libraries buffer protocol friendly types.
As a concrete example, numpy is adding the ndarray to that Union using this [
3]:
_BufferType = Union[ndarray, bytes, bytearray, memoryview]
Whilst this supports ndarray, it doesn't scale to the full list of third party types supporting buffer protocol(s) [opencv, pygame, pillow, ...].
Every suggestion appreciated -- even the strangest, ugliest, most horrific of hacks. Thanks.
cheers,