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
55fa9f1f
Commit
55fa9f1f
authored
Sep 03, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update memoryview documentation
parent
305a445f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
docs/src/userguide/memoryviews.rst
docs/src/userguide/memoryviews.rst
+13
-9
No files found.
docs/src/userguide/memoryviews.rst
View file @
55fa9f1f
...
...
@@ -11,6 +11,8 @@ current buffer support, but has more features and cleaner syntax. A memoryview
can be used in any context (function parameters, module-level, cdef class attribute, etc)
and can be obtained from any object that exposes the PEP 3118 buffer interface.
.. Note:: Support is experimental and new in this release, there may be bugs!
Memoryview slices
====================
...
...
@@ -37,6 +39,17 @@ copied to a C or Fortran contiguous array::
The `::1` in the slice type specification indicates in which dimension the data is contiguous.
It can only be used to specify full C or Fortran contiguity.
Slices can also be copied inplace::
cdef int[:, :, :] to_slice, from_slice
...
# copy the elements in from_slice to to_slice
to_slice[...] = from_slice
.. Note:: Copying of buffers with ``object`` as the base type is not supported yet.
Pointer types are not at all supported yet in memoryview slices.
Indexing and Slicing
--------------------
...
...
@@ -183,15 +196,6 @@ a lot, you're better off creating a memoryview object from your array::
cdef int[:, ::1] myslice = my_cython_array
memview = myslice
Base Types
==========
As the base type any type may be used (`object`, a struct, etc). If the type name is
not an identifier, you have to create a typedef for it::
ctypedef MyStruct *MyStruct_p
cdef MyStruct_p[:] myslice
The future
==========
In the future some functionality may be added for convenience, like
...
...
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