Commit 480bf89f authored by Stefan Behnel's avatar Stefan Behnel

add explicit section about literal prefixes to strings tutorial (and mention PEP 498 in it)

parent 60332baa
......@@ -55,10 +55,25 @@ Python 2 for backwards compatibility reasons. It is not compatible with
the :obj:`bytes` type. Its usage should be rare in normal Cython code as
the generic :obj:`object` type (i.e. untyped code) will normally be good
enough and has the additional advantage of supporting the assignment of
string subtypes. Support for the :obj:`basestring` type is new in Cython
string subtypes. Support for the :obj:`basestring` type was added in Cython
0.20.
String literals
---------------
Cython understands all Python string type prefixes:
* ``b'bytes'`` for byte strings
* ``u'text'`` for Unicode strings
* ``f'formatted {value}'`` for formatted Unicode string literals as defined by
`PEP 498 <https://www.python.org/dev/peps/pep-0498/>`_ (added in Cython 0.24)
Unprefixed string literals become :obj:`str` objects when compiling
with language level 2 and :obj:`unicode` objects (i.e. Python 3
:obj:`str`) with language level 3.
General notes about C strings
-----------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment