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
Gwenaël Samain
cython
Commits
eefadb88
Commit
eefadb88
authored
Aug 31, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suggest in docs that different ways of providing Python type declarations can be combined.
parent
52dc7120
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
docs/src/tutorial/pure.rst
docs/src/tutorial/pure.rst
+10
-8
No files found.
docs/src/tutorial/pure.rst
View file @
eefadb88
...
@@ -12,20 +12,22 @@ about 20%-50%.
...
@@ -12,20 +12,22 @@ about 20%-50%.
To go beyond that, Cython provides language constructs to add static typing
To go beyond that, Cython provides language constructs to add static typing
and cythonic functionalities to a Python module to make it run much faster
and cythonic functionalities to a Python module to make it run much faster
when compiled, while still allowing it to be interpreted.
when compiled, while still allowing it to be interpreted.
This is accomplished
either
via an augmenting ``.pxd`` file, via Python
This is accomplished via an augmenting ``.pxd`` file, via Python
type annotations (following
type annotations (following
`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ and
`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ and
`PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_), or
`PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_),
and/
or
via special functions and decorators available after importing the magic
via special functions and decorators available after importing the magic
``cython`` module.
``cython`` module. All three ways can be combined at need, although
projects would commonly decide on a specific way to keep the static type
information easy to manage.
Although it is not typically recommended over writing straight Cython code
Although it is not typically recommended over writing straight Cython code
in a :file:`.pyx` file, there are legitimate reasons to do this - easier
in a :file:`.pyx` file, there are legitimate reasons to do this - easier
testing
, collaboration with pure Python developers, etc. In pure mode, you
testing
and debugging, collaboration with pure Python developers, etc.
are more or less restricted to code that can be expressed (or at least
In pure mode, you are more or less restricted to code that can be expressed
emulated) in Python, plus static type declarations. Anything beyond that
(or at least emulated) in Python, plus static type declarations. Anything
can only be done in .pyx files with extended language syntax, because it
beyond that can only be done in .pyx files with extended language syntax,
depends on features of the Cython compiler.
because it
depends on features of the Cython compiler.
Augmenting .pxd
Augmenting .pxd
...
...
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