Permalink
Browse files

Documented the trick used in 9908201.

  • Loading branch information...
1 parent 9908201 commit 5aec69ed290552e7ea20bdef416c5bc23f6231f8 @aaugustin aaugustin committed Aug 3, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 docs/topics/python3.txt
View
5 docs/topics/python3.txt
@@ -36,6 +36,11 @@ In order to enable the same behavior in Python 2, every module must import
my_string = "This is an unicode literal"
my_bytestring = b"This is a bytestring"
+If you need a byte string under Python 2 and a unicode string under Python 3,
+use the :func:`str` builtin::
+
+ str('my string')
+
Be cautious if you have to `slice bytestrings`_.
.. _slice bytestrings: http://docs.python.org/py3k/howto/pyporting.html#bytes-literals

0 comments on commit 5aec69e

Please sign in to comment.