PEP 358 and operations on bytes

Gerrit Holl gerrit at nl.linux.org
Tue Oct 3 13:24:41 EDT 2006


Hi,

In Python 3, reading from a file gives bytes rather than characters.
Some operations currently performed on strings also make sense when
performed on bytes, either if it's binary data or if it's text of
unknown or mixed encoding. Those include of course slicing and other
operators that exist in lists, but also other operations that aren't
currently defined in PEP 358, like:

    - str methods endswith, find, partition, replace, split(lines),
      startswith,
    - Regular expressions

I think those can be useful on a bytes type. Perhaps bytes and str could
share a common parent class? They certainly share a lot of properties
and possible operations one might want to perform.

kind regards,
Gerrit Holl.

-- 
My first English-language post ever was made to this newsgroup:
http://groups.google.com/group/comp.lang.python/msg/f957acf785ddfb71 :)



More information about the Python-list mailing list