[Python-3000] Immutable bytes -- looking for volunteer
victor.stinner at haypocalc.com
Wed Sep 19 12:12:10 CEST 2007
On Tuesday 18 September 2007 04:18:01 Guido van Rossum wrote:
> I'm considering the following option: bytes would always be immutable,
> (...) make b return a bytes array of length 1 instead of a small int
Great idea! That will help migration from Python 2.x to Python 3.0. Choosing
between byte and character string is already a difficult choice. So choosing
between mutable (current bytes type) and immutable string (current str type)
is a more difficult choice.
And substring behaviour change (python 2.x => 3) was also strange for python
This result is not symmetric. I would prefer what Guido proposes:
And so be able to write such tests:
>>> b"xyz"[:2] == b'xy'
>>> b"xyz"[0:1] == b'x'
>>> b"xyz" == b'x'
More information about the Python-3000