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
853e8c6c
Commit
853e8c6c
authored
Jun 15, 2018
by
scoder
Committed by
GitHub
Jun 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2335 from gabrieldemarmiesse/pure_python_mode_2
Adding tests for "pure python mode" part 2
parents
f29ae73c
1fc7e64c
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 @
853e8c6c
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
))
docs/src/tutorial/pure.rst
View file @
853e8c6c
...
@@ -50,23 +50,9 @@ and adds :file:`A.pxd`:
...
@@ -50,23 +50,9 @@ and adds :file:`A.pxd`:
.. literalinclude:: ../../examples/tutorial/pure/A.pxd
.. literalinclude:: ../../examples/tutorial/pure/A.pxd
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,
...
...
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