[docs] [issue10702] bytes and bytearray methods are not documented

Xuanji Li report at bugs.python.org
Sun Dec 19 15:14:29 CET 2010

Xuanji Li <xuanji at gmail.com> added the comment:

Hi, it seems to me that section 4.6.5. Bytes and Byte Array Methods covers this already. It says:

Bytes and bytearray objects, being “strings of bytes”, have all methods found on strings, with the exception of encode(), format() and isidentifier(), which do not make sense with these types. For converting the objects to strings, they have a decode() method.

Wherever one of these methods needs to interpret the bytes as characters (e.g. the is...() methods), the ASCII character set is assumed.

This section covers belpolsky's needs, ie a reader can, from this, understand that bytes have a capitalize method. However, I support

1) Expanding this section to explain more clearly what the methods do to bytes
2) Discuss unicode vs bytes details
3) Mention bytes and bytearrays in 4.6.1 String Methods, because it is quite far away from 4.6.5

As for the suggestion of renaming, if we rename the section, we have to decide what to call a string/byte/bytearray object because it now says, for example, str.something(); also we have to document the encode and decode methods seperately because they are not common to strings and bytes.


Python tracker <report at bugs.python.org>

More information about the docs mailing list