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
01198ace
Commit
01198ace
authored
6 years ago
by
scoder
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2337 from gabrieldemarmiesse/pure_python_mode_4
Adding tests for "pure python mode" part 4
parents
27b8f4ee
59b13ab0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
docs/examples/tutorial/pure/cython_declare.py
docs/examples/tutorial/pure/cython_declare.py
+4
-0
docs/examples/tutorial/pure/cython_declare2.py
docs/examples/tutorial/pure/cython_declare2.py
+3
-0
docs/src/tutorial/pure.rst
docs/src/tutorial/pure.rst
+4
-5
No files found.
docs/examples/tutorial/pure/cython_declare.py
0 → 100644
View file @
01198ace
import
cython
x
=
cython
.
declare
(
cython
.
int
)
# cdef int x
y
=
cython
.
declare
(
cython
.
double
,
0.57721
)
# cdef double y = 0.57721
This diff is collapsed.
Click to expand it.
docs/examples/tutorial/pure/cython_declare2.py
0 → 100644
View file @
01198ace
import
cython
cython
.
declare
(
x
=
cython
.
int
,
y
=
cython
.
double
)
# cdef int x; cdef double y
This diff is collapsed.
Click to expand it.
docs/src/tutorial/pure.rst
View file @
01198ace
...
...
@@ -122,14 +122,13 @@ Static typing
* ``cython.declare`` declares a typed variable in the current scope, which can be
used in place of the :samp:`cdef type var [= value]` construct. This has two forms,
the first as an assignment (useful as it creates a declaration in interpreted
mode as well):
:
mode as well):
x = cython.declare(cython.int) # cdef int x
y = cython.declare(cython.double, 0.57721) # cdef double y = 0.57721
.. literalinclude:: ../../examples/tutorial/pure/cython_declare.py
and the second mode as a simple function call:
:
and the second mode as a simple function call:
cython.declare(x=cython.int, y=cython.double) # cdef int x; cdef double
y
.. literalinclude:: ../../examples/tutorial/pure/cython_declare2.p
y
It can also be used to type class constructors::
...
...
This diff is collapsed.
Click to expand it.
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