[Python-Dev] buffer objects

Jack Jansen Jack.Jansen@oratrix.com
Thu, 2 May 2002 22:51:01 +0200


On donderdag, mei 2, 2002, at 06:46 , Scott Gilbert wrote:
> I guess I'm not getting the Python philosophy of things then.  We have
> "string"s which are doubling as readonly-byte-arrays and 
> text-strings, and
> I thought the concensus around here was that this was an unfortunate
> duality.  Then we have "unicode"s which are clearly just for 
> text-strings.
> Both of these are immutable as per the philosophy that strings 
> are a lot
> like numbers.
>
> Then we have buffer objects.  If the buffer object is a 
> mistake, then there
> is no endorsed way to get at a (possibly mutable) array of bytes from
> Python.  One can use arrays of typecode 'B', but you can't 
> point those at
> your own memory, and they don't pickle.
>
> So if someone would only charge up the time machine, I thought 
> it would be
> preferrable to only have unicode objects, and buffer objects.  
> (Possibly
> with unicode objects being renamed as strings instead...)

I think we need immutable binary byte arrays as well, these are 
used for code objects and such. But I agree that a mutable 
binary array type such as the bufferobject is needed for 
efficient Python implementation of lots of things.
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -