On 8/7/07, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On 8/7/07, Collin Winter <[EMAIL PROTECTED]> wrote:
> > Could someone please explain to me the conceptual difference between
> > array.array('B'), bytes(), buffer objects and simple lists of
> > integers? I'm confused about when I should use which.
[bytes and array.array are similar, but bytes have extra methods and a
literal notation]
[buffer is read-only to your code, but may not be immutable]
> Lists of integers don't have the property that the other three share
> which is that their C representation is a contiguous array of bytes
> (char* in C). This representation is important because to do efficient
> I/O in C you need char*.
This sounds almost as if they were all interchangable implementations
of the same interface, and you should choose based on quality of
implementation.
If the need for immutable isn't worth a distinct type, I'm not sure
why "I want it to be fast" is worth two (or three) extra types,
distinguished by the equivalent of cursor isolation level.
FWLIW, I think the migration path for the existing three types makes
sense, but I would like b" ... " to be an immutable bytes object, and
bytes(" ... ") to be the constructor for something that can mutate.
-jJ
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com