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
e50ee3d8
Commit
e50ee3d8
authored
Jan 02, 2022
by
Matus Valo
Committed by
GitHub
Jan 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document @cython.compile (GH-4551)
Closes
https://github.com/cython/cython/issues/2770
parent
b4e91aa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
docs/src/userguide/source_files_and_compilation.rst
docs/src/userguide/source_files_and_compilation.rst
+29
-0
No files found.
docs/src/userguide/source_files_and_compilation.rst
View file @
e50ee3d8
...
...
@@ -605,6 +605,35 @@ Unbound variables are automatically pulled from the surrounding local
and global scopes, and the result of the compilation is cached for
efficient re-use.
Compiling with ``cython.compile``
=================================
Cython supports transparent compiling of the cython code in a function using the
``@cython.compile`` dedorator::
@cython.compile
def plus(a, b):
return a + b
Parameters of the decorated function cannot have type declarations. Their types are
automatically determined from values passed to the function, thus leading to one or more
specialised compiled functions for the respective argument types.
Executing example::
import cython
@cython.compile
def plus(a, b):
return a + b
print(plus('3', '5'))
print(plus(3, 5))
will produce following output::
35
8
.. _compiling_with_sage:
Compiling with Sage
...
...
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