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
a8827af0
Commit
a8827af0
authored
Jun 14, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put the first code snippet from "working with python arrays" in the examples directory.
parent
5fadf79e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
docs/examples/tutorial/array/safe_usage.pyx
docs/examples/tutorial/array/safe_usage.pyx
+6
-0
docs/src/tutorial/array.rst
docs/src/tutorial/array.rst
+1
-8
No files found.
docs/examples/tutorial/array/safe_usage.pyx
0 → 100644
View file @
a8827af0
from
cpython
cimport
array
import
array
cdef
array
.
array
a
=
array
.
array
(
'i'
,
[
1
,
2
,
3
])
cdef
int
[:]
ca
=
a
print
(
ca
[
0
])
docs/src/tutorial/array.rst
View file @
a8827af0
...
@@ -18,14 +18,7 @@ module is built into both Python and Cython.
...
@@ -18,14 +18,7 @@ module is built into both Python and Cython.
Safe usage with memory views
Safe usage with memory views
----------------------------
----------------------------
::
.. literalinclude:: ../../examples/tutorial/array/safe_usage.pyx
from cpython cimport array
import array
cdef array.array a = array.array('i', [1, 2, 3])
cdef int[:] ca = a
print(ca[0])
NB: the import brings the regular Python array object into the namespace
NB: the import brings the regular Python array object into the namespace
while the cimport adds functions accessible from Cython.
while the cimport adds functions accessible from Cython.
...
...
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