Commit 18bc21f1 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Simplified the first example of fused types.

parent 084a25f5
from __future__ import print_function from __future__ import print_function
cimport cython
ctypedef fused char_or_float: ctypedef fused char_or_float:
cython.char char
cython.float float
cpdef char_or_float plus_one(char_or_float var): cpdef char_or_float plus_one(char_or_float var):
...@@ -12,7 +11,7 @@ cpdef char_or_float plus_one(char_or_float var): ...@@ -12,7 +11,7 @@ cpdef char_or_float plus_one(char_or_float var):
def show_me(): def show_me():
cdef: cdef:
cython.char a = 127 char a = 127
cython.float b = 127 float b = 127
print('char', plus_one(a)) print('char', plus_one(a))
print('float', plus_one(b)) print('float', plus_one(b))
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