summaryrefslogtreecommitdiff
path: root/docs/examples/tutorial/array/overhead.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/tutorial/array/overhead.pyx')
-rw-r--r--docs/examples/tutorial/array/overhead.pyx32
1 files changed, 17 insertions, 15 deletions
diff --git a/docs/examples/tutorial/array/overhead.pyx b/docs/examples/tutorial/array/overhead.pyx
index e385bff3f..a113e8dc9 100644
--- a/docs/examples/tutorial/array/overhead.pyx
+++ b/docs/examples/tutorial/array/overhead.pyx
@@ -1,15 +1,17 @@
-from cpython cimport array
-import array
-
-cdef array.array a = array.array('i', [1, 2, 3])
-cdef int[:] ca = a
-
-cdef int overhead(object a):
- cdef int[:] ca = a
- return ca[0]
-
-cdef int no_overhead(int[:] ca):
- return ca[0]
-
-print(overhead(a)) # new memory view will be constructed, overhead
-print(no_overhead(ca)) # ca is already a memory view, so no overhead
+from cpython cimport array
+import array
+
+cdef array.array a = array.array('i', [1, 2, 3])
+cdef int[:] ca = a
+
+
+cdef int overhead(object a):
+ cdef int[:] ca = a
+ return ca[0]
+
+
+cdef int no_overhead(int[:] ca):
+ return ca[0]
+
+print(overhead(a)) # new memory view will be constructed, overhead
+print(no_overhead(ca)) # ca is already a memory view, so no overhead