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
Gwenaël Samain
cython
Commits
f780ba4c
Commit
f780ba4c
authored
Jun 15, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved a fifth piece of code from array.rst to the examples directory.
parent
ff577a2b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
docs/examples/tutorial/array/resize.pyx
docs/examples/tutorial/array/resize.pyx
+10
-0
docs/src/tutorial/array.rst
docs/src/tutorial/array.rst
+1
-12
No files found.
docs/examples/tutorial/array/resize.pyx
0 → 100644
View file @
f780ba4c
from
cpython
cimport
array
import
array
cdef
array
.
array
a
=
array
.
array
(
'i'
,
[
1
,
2
,
3
])
cdef
array
.
array
b
=
array
.
array
(
'i'
,
[
4
,
5
,
6
])
# extend a with b, resize as needed
array
.
extend
(
a
,
b
)
# resize a, leaving just original three elements
array
.
resize
(
a
,
len
(
a
)
-
len
(
b
))
docs/src/tutorial/array.rst
View file @
f780ba4c
...
...
@@ -93,18 +93,7 @@ An array can also be extended and resized; this avoids repeated memory
reallocation which would occur if elements would be appended or removed
one by one.
::
from cpython cimport array
import array
cdef array.array a = array.array('i', [1, 2, 3])
cdef array.array b = array.array('i', [4, 5, 6])
# extend a with b, resize as needed
array.extend(a, b)
# resize a, leaving just original three elements
array.resize(a, len(a) - len(b))
.. literalinclude:: ../../examples/tutorial/array/resize.pyx
API reference
...
...
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