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
Kirill Smelkov
cython
Commits
9d7873cd
Commit
9d7873cd
authored
Jun 15, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved a fourth piece of code from array.rst to the example directory for testing.
parent
ff577a2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
docs/examples/tutorial/array/clone.pyx
docs/examples/tutorial/array/clone.pyx
+8
-0
docs/src/tutorial/array.rst
docs/src/tutorial/array.rst
+1
-10
No files found.
docs/examples/tutorial/array/clone.pyx
0 → 100644
View file @
9d7873cd
from
cpython
cimport
array
import
array
cdef
array
.
array
int_array_template
=
array
.
array
(
'i'
,
[])
cdef
array
.
array
newarray
# create an array with 3 elements with same type as template
newarray
=
array
.
clone
(
int_array_template
,
3
,
zero
=
False
)
docs/src/tutorial/array.rst
View file @
9d7873cd
...
...
@@ -78,16 +78,7 @@ it is possible to create a new array with the same type as a template,
and preallocate a given number of elements. The array is initialized to
zero when requested.
::
from cpython cimport array
import array
cdef array.array int_array_template = array.array('i', [])
cdef array.array newarray
# create an array with 3 elements with same type as template
newarray = array.clone(int_array_template, 3, zero=False)
.. literalinclude:: ../../examples/tutorial/array/clone.pyx
An array can also be extended and resized; this avoids repeated memory
reallocation which would occur if elements would be appended or removed
...
...
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