On 11/10/12 02:23, boB Stepp wrote:

bytes have string methods as a convenience, such as find, split, and
partition. They also have the method decode(), which uses a specified
encoding such as "utf-8" to create a string from an encoded bytes
sequence.

What is the intended use of byte types?

One purpose is to facilitate the handling of raw data streams such as might be read from a binary file or over a network. If you are using locale settings with 16 bit characters reading such a stream as a character string will result in you processing pairs of bytes at a time. Using a byte string you guarantee you process 8 bits at a time with no attempt at interpretation.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to