Commit a8827af0 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Put the first code snippet from "working with python arrays" in the examples directory.

parent 5fadf79e
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.
Safe usage with memory views
----------------------------
::
from cpython cimport array
import array
cdef array.array a = array.array('i', [1, 2, 3])
cdef int[:] ca = a
print(ca[0])
.. literalinclude:: ../../examples/tutorial/array/safe_usage.pyx
NB: the import brings the regular Python array object into the namespace
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