What is the Python 'buffer' type for?

Viewed 171628

There is a buffer type in Python, but how can I use it?

In the Python documentation about buffer(), the description is:

buffer(object[, offset[, size]])

The object argument must be an object that supports the buffer call interface (such as strings, arrays, and buffers). A new buffer object will be created which references the object argument. The buffer object will be a slice from the beginning of object (or from the specified offset). The slice will extend to the end of object (or will have a length given by the size argument).

2 Answers
Related