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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
6008886f
Commit
6008886f
authored
8 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.24.x'
parents
97739979
480bf89f
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
docs/src/tutorial/strings.rst
docs/src/tutorial/strings.rst
+18
-3
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+2
-0
No files found.
docs/src/tutorial/strings.rst
View file @
6008886f
...
...
@@ -20,8 +20,8 @@ Cython supports four Python string types: :obj:`bytes`, :obj:`str`,
:obj:`unicode` and :obj:`basestring`. The :obj:`bytes` and :obj:`unicode` types
are the specific types known from normal Python 2.x (named :obj:`bytes`
and :obj:`str` in Python 3). Additionally, Cython also supports the
:obj:`bytearray` type
starting with Python 2.6. It behaves like the
:obj:`bytes` type, except
that it is mutable.
:obj:`bytearray` type
which behaves like the :obj:`bytes` type, except
that it is mutable.
The :obj:`str` type is special in that it is the byte string in Python 2
and the Unicode string in Python 3 (for Cython code compiled with
...
...
@@ -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
-----------------------------
...
...
This diff is collapsed.
Click to expand it.
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
6008886f
...
...
@@ -277,6 +277,8 @@ A convienient and safe place to do so is in the `__cinit__` and `__dealloc__` me
which are guaranteed to be called exactly once upon creation and deletion of the Python
instance.
::
cdef class PyRectangle:
cdef Rectangle* c_rect # hold a pointer to the C++ instance which we're wrapping
def __cinit__(self, int x0, int y0, int x1, int y1):
...
...
This diff is collapsed.
Click to expand it.
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