[Python-3000-checkins] r57867 - python/branches/py3k/Doc/library/stdtypes.rst

georg.brandl python-3000-checkins at python.org
Sat Sep 1 14:09:38 CEST 2007


Author: georg.brandl
Date: Sat Sep  1 14:08:51 2007
New Revision: 57867

Modified:
   python/branches/py3k/Doc/library/stdtypes.rst
Log:
Add a warning text about mixing bytes and strings.


Modified: python/branches/py3k/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/py3k/Doc/library/stdtypes.rst	(original)
+++ python/branches/py3k/Doc/library/stdtypes.rst	Sat Sep  1 14:08:51 2007
@@ -515,6 +515,12 @@
    object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes
    object of length 1.
 
+   Also, while in previous Python versions, byte strings and Unicode strings
+   could be exchanged for each other rather freely (barring encoding issues),
+   strings and bytes are completely separate concepts.  There's no implicit
+   en-/decoding if you pass and object of the wrong type or try to e.g. compare
+   a string with a bytes object.
+
 Lists are constructed with square brackets, separating items with commas: ``[a,
 b, c]``.  Tuples are constructed by the comma operator (not within square
 brackets), with or without enclosing parentheses, but an empty tuple must have


More information about the Python-3000-checkins mailing list