Commit 83c3fb35 authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2427 from gabrieldemarmiesse/test_fused_types_2

Simplified the first example of fused types.
parents 8eeea273 18bc21f1
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