18 Jan
2014
18 Jan
'14
7:26 a.m.
Steven D'Aprano, 18.01.2014 02:27:
On Fri, Jan 17, 2014 at 08:49:21AM -0800, Ethan Furman wrote:
%s is restricted in what it will accept::
- input type supports Py_buffer? use it to collect the necessary bytes
Can you give some examples of what types support Py_buffer? Presumably bytes. Anything else?
Lots of things: bytes, bytearray, memoryview, array.array, NumPy arrays, just to name a few. Basically anything that wants itself to be representable as a chunk of memory with metadata. It's a very common thing in the Big Data department (although many people wouldn't know that they're actually heavy users of this protocol because they just use NumPy and/or Cython and don't look under the hood). Stefan