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
1fc7e64c
Commit
1fc7e64c
authored
6 years ago
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put the code example from "pure python mode" in a file in the examples directory for testing.
parent
5fadf79e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
docs/examples/tutorial/pure/A_equivalent.pyx
docs/examples/tutorial/pure/A_equivalent.pyx
+15
-0
docs/src/tutorial/pure.rst
docs/src/tutorial/pure.rst
+2
-16
No files found.
docs/examples/tutorial/pure/A_equivalent.pyx
0 → 100644
View file @
1fc7e64c
cpdef
int
myfunction
(
int
x
,
int
y
=
2
):
a
=
x
-
y
return
a
+
x
*
y
cdef
double
_helper
(
double
a
):
return
a
+
1
cdef
class
A
:
cdef
public
int
a
,
b
def
__init__
(
self
,
b
=
0
):
self
.
a
=
3
self
.
b
=
b
cpdef
foo
(
self
,
double
x
):
print
(
x
+
_helper
(
1.0
))
This diff is collapsed.
Click to expand it.
docs/src/tutorial/pure.rst
View file @
1fc7e64c
...
@@ -68,23 +68,9 @@ and adds :file:`A.pxd`::
...
@@ -68,23 +68,9 @@ and adds :file:`A.pxd`::
cdef public int a,b
cdef public int a,b
cpdef foo(self, double x)
cpdef foo(self, double x)
then Cython will compile the :file:`A.py` as if it had been written as follows:
:
then Cython will compile the :file:`A.py` as if it had been written as follows:
cpdef int myfunction(int x, int y=2):
.. literalinclude:: ../../examples/tutorial/pure/A_equivalent.pyx
a = x-y
return a + x * y
cdef double _helper(double a):
return a + 1
cdef class A:
cdef public int a,b
def __init__(self, b=0):
self.a = 3
self.b = b
cpdef foo(self, double x):
print(x + _helper(1.0))
Notice how in order to provide the Python wrappers to the definitions
Notice how in order to provide the Python wrappers to the definitions
in the :file:`.pxd`, that is, to be accessible from Python,
in the :file:`.pxd`, that is, to be accessible from Python,
...
...
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