Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
480bf89f
Commit
480bf89f
authored
Mar 26, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add explicit section about literal prefixes to strings tutorial (and mention PEP 498 in it)
parent
60332baa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
docs/src/tutorial/strings.rst
docs/src/tutorial/strings.rst
+16
-1
No files found.
docs/src/tutorial/strings.rst
View file @
480bf89f
...
...
@@ -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
-----------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment