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
Boxiang Sun
cython
Commits
96d5dbc3
Commit
96d5dbc3
authored
Jun 27, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved an example from the docs to the examples directory.
parent
084a25f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
docs/examples/userguide/memoryviews/np_flag_const.pyx
docs/examples/userguide/memoryviews/np_flag_const.pyx
+7
-0
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+2
-6
No files found.
docs/examples/userguide/memoryviews/np_flag_const.pyx
0 → 100644
View file @
96d5dbc3
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
docs/src/userguide/memoryviews.rst
View file @
96d5dbc3
...
...
@@ -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::
...
...
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