arraymodule questions

Mark Hammond mhammond at skippinet.com.au
Sat Apr 1 06:49:47 EST 2000


> So my questions are about changes for Python 1.6:
>   1) would it be okay to make the arrayobject C API available?
>   2) could I add the .append optimizations mentioned above?
>   3) should I also add the code to preallocated space?

How about if we better expose a "buffer" object.  There is a
Python C API for a new read-write buffer object, but it is not
exposed to Python code.

It is basically a fixed array("c"), and supports all slicing and
assignment operations.  The difference from an array object is
that its size is fixed, but that can sometimes be a bonus.

I wouldnt mind seeing the builtin buffer() function check for an
integer argument, and have it return a read-write buffer object
of that size.

eg:
buffer(string_object) now returns a read-only buffer into the
string object.  As buffer(10) doesnt make sense in that context,
buffer(10) could return a read-write buffer of size 10.

>From you description, this would be an alternative solution?

Mark.





More information about the Python-list mailing list