summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-09-01 12:08:51 (GMT)
committerGeorg Brandl <georg@python.org>2007-09-01 12:08:51 (GMT)
commit2326a79de134281b12b3ed04eeabcc8c403df57d (patch)
tree15ee1af7f4979c4bea6bce28f4270dd15ea0f2fd
parent37f10386f1bedb992f3d9770b2f71b5edda2abbe (diff)
downloadcpython-2326a79de134281b12b3ed04eeabcc8c403df57d.zip
cpython-2326a79de134281b12b3ed04eeabcc8c403df57d.tar.gz
cpython-2326a79de134281b12b3ed04eeabcc8c403df57d.tar.bz2
Add a warning text about mixing bytes and strings.
-rw-r--r--Doc/library/stdtypes.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 96c0b26..93d00a3 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -515,6 +515,12 @@ constructed from literals too; use a ``b`` prefix with normal string syntax:
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