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.

Assuming you weren't being sarcastic, array('B') and bytes() are very
close except bytes have a literal notation and many string-ish
methods. The buffer objects returned by the buffer() builtin provide a
read-only view on other objects that happen to have an internal
buffer, like strings, bytes, arrays, PIL images, and numpy arrays.
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*.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
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

Reply via email to