summaryrefslogtreecommitdiff
path: root/docs/examples/tutorial/string
diff options
context:
space:
mode:
authorgabrieldemarmiesse <gabriel.demarmiesse@teraki.com>2018-06-20 23:41:22 +0200
committergabrieldemarmiesse <gabriel.demarmiesse@teraki.com>2018-06-20 23:41:22 +0200
commitd17d4e96f7633a7b7848f2136102c5c58b91414e (patch)
tree260da04b88b8efad9d29c031a6e27d646cfcb1ce /docs/examples/tutorial/string
parent9e55199c84a37a79f035604f3a11d879ebaca6fa (diff)
downloadcython-d17d4e96f7633a7b7848f2136102c5c58b91414e.tar.gz
Put a dummy processing in the function rather than asking the user for decision.
Diffstat (limited to 'docs/examples/tutorial/string')
-rw-r--r--docs/examples/tutorial/string/return_memview.pyx8
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/examples/tutorial/string/return_memview.pyx b/docs/examples/tutorial/string/return_memview.pyx
index 443e91636..f6233436a 100644
--- a/docs/examples/tutorial/string/return_memview.pyx
+++ b/docs/examples/tutorial/string/return_memview.pyx
@@ -1,7 +1,9 @@
-def process_byte_data(unsigned char[:] data, bint return_all):
- # ... process the data
+def process_byte_data(unsigned char[:] data):
+ # ... process the data, here, dummy processing.
+ cdef bint return_all = (data[0] == 108)
+
if return_all:
return bytes(data)
else:
# example for returning a slice
- return bytes(data[5:35])
+ return bytes(data[5:7])