diff options
Diffstat (limited to 'docs/examples/tutorial/array/resize.py')
-rw-r--r-- | docs/examples/tutorial/array/resize.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/examples/tutorial/array/resize.py b/docs/examples/tutorial/array/resize.py new file mode 100644 index 000000000..c2e50472f --- /dev/null +++ b/docs/examples/tutorial/array/resize.py @@ -0,0 +1,10 @@ +from cython.cimports.cpython import array +import array + +a = cython.declare(array.array, array.array('i', [1, 2, 3])) +b = cython.declare(array.array, 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)) |