Commit 338e6910 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Moved an example from fusedtypes.rst to the examples directory.

parent 5c04c1a8
from __future__ import print_function
cimport cython
ctypedef fused char_or_float:
cython.char
cython.float
cpdef char_or_float plus_one(char_or_float var):
return var + 1
def show_me():
cdef:
cython.char a = 127
cython.float b = 127
print('char', plus_one(a))
print('float', plus_one(b))
......@@ -24,26 +24,7 @@ Java / C#.
Quickstart
==========
::
from __future__ import print_function
cimport cython
ctypedef fused char_or_float:
cython.char
cython.float
cpdef char_or_float plus_one(char_or_float var):
return var + 1
def show_me():
cdef:
cython.char a = 127
cython.float b = 127
print('char', plus_one(a))
print('float', plus_one(b))
.. literalinclude:: ../../examples/userguide/fusedtypes/char_or_float.pyx
This gives::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment