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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
18bc21f1
Commit
18bc21f1
authored
Jun 26, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified the first example of fused types.
parent
084a25f5
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 @
18bc21f1
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