[docs] [issue16518] add "buffer protocol" to glossary
report at bugs.python.org
Fri Nov 23 22:57:42 CET 2012
Antoine Pitrou added the comment:
> > Well, we should still write a Python documentation, not a NumPy
> > documentation (on this tracker anyway). Outside of NumPy, there's little
> > use for multi-dimensional objects.
> Ok, but people should not be surprised if their (Python) array.array() of
> double or their array of ctypes structs is silently accepted by some byte
> consuming function.
Probably. My own (humble :-)) opinion is that array.array() is a
historical artifact, and its use doesn't seem to be warranted in modern
Python code. ctypes is obviously a very special library, and not for the
faint of heart.
> How about "object does not provide a byte buffer" for error messages
> and "(byte) buffer provider" as a shorthand for "any buffer provider
> that exposes its memory as a sequence of unsigned bytes in response
> to a PyBUF_SIMPLE request"?
It's not too bad, I think. However, what I think is important is that
the average (non-expert) Python developer understand that the function
really accepts a bytes object, and other similar types (because, really,
bytes is the only bytes-like type most developers will ever face).
That's why I'm proposing "bytes-like object".
Python tracker <report at bugs.python.org>
More information about the docs