Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
83c3fb35
Commit
83c3fb35
authored
Jul 07, 2018
by
scoder
Committed by
GitHub
Jul 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2427 from gabrieldemarmiesse/test_fused_types_2
Simplified the first example of fused types.
parents
8eeea273
18bc21f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
docs/examples/userguide/fusedtypes/char_or_float.pyx
docs/examples/userguide/fusedtypes/char_or_float.pyx
+4
-5
No files found.
docs/examples/userguide/fusedtypes/char_or_float.pyx
View file @
83c3fb35
from
__future__
import
print_function
from
__future__
import
print_function
cimport
cython
ctypedef
fused
char_or_float
:
ctypedef
fused
char_or_float
:
c
ython
.
c
har
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
:
c
ython
.
c
har
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
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment