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
Kirill Smelkov
cython
Commits
338e6910
Commit
338e6910
authored
Jun 17, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved an example from fusedtypes.rst to the examples directory.
parent
5c04c1a8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
20 deletions
+19
-20
docs/examples/userguide/fusedtypes/char_or_float.pyx
docs/examples/userguide/fusedtypes/char_or_float.pyx
+18
-0
docs/src/userguide/fusedtypes.rst
docs/src/userguide/fusedtypes.rst
+1
-20
No files found.
docs/examples/userguide/fusedtypes/char_or_float.pyx
0 → 100644
View file @
338e6910
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
))
docs/src/userguide/fusedtypes.rst
View file @
338e6910
...
...
@@ -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::
...
...
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