[Python-3000] Last call for PEP 3137: Immutable Bytes and Mutable Buffer

Guido van Rossum guido at python.org
Mon Oct 1 04:59:16 CEST 2007


On 9/30/07, Carsten Haese <carsten at uniqsys.com> wrote:
> On Sun, 2007-09-30 at 16:25 -0700, Guido van Rossum wrote:
> > [...]
> > (**Note:** in Python 3.0a1, comparing a bytes instance with a str
> > instance would raise TypeError, on the premise that this would catch
> > the occasional mistake quicker, especially in code ported from Python
> > 2.x.  However, a long discussion on the python-3000 list pointed out
> > so many problems with this that it is clearly a bad idea, to be rolled
> > back in 3.0a2 regardless of the fate of the rest of this PEP.)
> > [...]
> > Like the bytes type in Python 3.0a1, and unlike the relationship
> > between str and unicode in Python 2.x, any attempt to mix bytes (or
> > buffer) objects and str objects without specifying an encoding will
> > raise a TypeError exception.  This is the case even for simply
> > comparing a bytes or buffer object to a str object (even violating the
> > general rule that comparing objects of different types for equality
> > should just return False).
>
> It appears that you didn't revise the latter paragraph after adding the
> former paragraph.

Good catch! Fixed in svn. The latter paragraph now reads:

"""
Like the bytes type in Python 3.0a1, and unlike the relationship
between str and unicode in Python 2.x, attempts to mix bytes (or
buffer) objects and str objects without specifying an encoding will
raise a TypeError exception.  (However, comparing bytes/buffer and str
objects for equality will simply return False; see the section on
Comparisons above.)
"""

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list