[Python-checkins] r58290 - peps/trunk/pep-3137.txt
guido.van.rossum
python-checkins at python.org
Mon Oct 1 01:19:14 CEST 2007
Author: guido.van.rossum
Date: Mon Oct 1 01:19:14 2007
New Revision: 58290
Modified:
peps/trunk/pep-3137.txt
Log:
Changed my mind on comparing bytes to str.
Modified: peps/trunk/pep-3137.txt
==============================================================================
--- peps/trunk/pep-3137.txt (original)
+++ peps/trunk/pep-3137.txt Mon Oct 1 01:19:14 2007
@@ -8,7 +8,7 @@
Content-Type: text/x-rst
Created: 26-Sep-2007
Python-Version: 3.0
-Post-History: 26-Sep-2007
+Post-History: 26-Sep-2007, 30-Sep-2007
Introduction
============
@@ -124,8 +124,18 @@
The bytes and buffer types are comparable with each other and
orderable, so that e.g. b'abc' == buffer(b'abc') < b'abd'.
-Comparing either type to a str object raises an exception. This
-turned out to be necessary to catch common mistakes.
+Comparing either type to a str object for equality returns False
+regardless of the contents of either operand. Ordering comparisons
+with str raise TypeError. This is all conformant to the standard
+rules for comparison and ordering between objects of incompatible
+types.
+
+(**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.)
Slicing
-------
More information about the Python-checkins
mailing list