On Jan 7, 8:14 pm, Neal Becker <ndbeck...@gmail.com> wrote: > Problem is, AFAIK a string can only be created as a copy of some other data. > Say I'd like to take some large object and read/write to/from mmap object. A > good way to do this would be the buffer protocol. Unfortunately, mmap only > supports string. A string could only be created after copying the original > object AFAIK. > > I think mmap should work directly with buffer protocol, so it could directly > read/write with objects supporting buffer protocol. Specifically, mmap slice > should support buffer protocol.
Hi. It is a weakness. Strings are supposed to be read-only in Python: so. You can use and get the PyObject_AsWriteBuffer C function from 'ctypes' if you are interested. -- http://mail.python.org/mailman/listinfo/python-list