Commit 96d5dbc3 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Moved an example from the docs to the examples directory.

parent 084a25f5
import numpy as np
cdef const double[:] myslice # const item type => read-only view
a = np.linspace(0, 10, num=50)
a.setflags(write=False)
myslice = a
......@@ -178,13 +178,9 @@ Read-only views
---------------
Since Cython 0.28, the memoryview item type can be declared as ``const`` to
support read-only buffers as input::
support read-only buffers as input:
cdef const double[:] myslice # const item type => read-only view
a = np.linspace(0, 10, num=50)
a.setflags(write=False)
myslice = a
.. literalinclude:: ../../examples/userguide/memoryviews/np_flag_const.pyx
Note that this does not *require* the input buffer to be read-only::
......
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