Commit 47c52132 authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2342 from gabrieldemarmiesse/test_working_with_python_arrays_1

Added test of a piece of code in "working with python arrays".
parents 9c4d28fb a8827af0
from cpython cimport array
import array
cdef array.array a = array.array('i', [1, 2, 3])
cdef int[:] ca = a
print(ca[0])
...@@ -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.
......
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