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
f29ae73c
Commit
f29ae73c
authored
Jun 15, 2018
by
scoder
Committed by
GitHub
Jun 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2334 from gabrieldemarmiesse/pure_python_mode_1
Adding tests for "pure python mode" part 1
parents
1310d1eb
881d2c05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
22 deletions
+24
-22
docs/examples/tutorial/pure/A.pxd
docs/examples/tutorial/pure/A.pxd
+6
-0
docs/examples/tutorial/pure/A.py
docs/examples/tutorial/pure/A.py
+14
-0
docs/src/tutorial/pure.rst
docs/src/tutorial/pure.rst
+4
-22
No files found.
docs/examples/tutorial/pure/A.pxd
0 → 100644
View file @
f29ae73c
cpdef
int
myfunction
(
int
x
,
int
y
=*
)
cdef
double
_helper
(
double
a
)
cdef
class
A
:
cdef
public
int
a
,
b
cpdef
foo
(
self
,
double
x
)
docs/examples/tutorial/pure/A.py
0 → 100644
View file @
f29ae73c
def
myfunction
(
x
,
y
=
2
):
a
=
x
-
y
return
a
+
x
*
y
def
_helper
(
a
):
return
a
+
1
class
A
:
def
__init__
(
self
,
b
=
0
):
self
.
a
=
3
self
.
b
=
b
def
foo
(
self
,
x
):
print
(
x
+
_helper
(
1.0
))
docs/src/tutorial/pure.rst
View file @
f29ae73c
...
...
@@ -42,31 +42,13 @@ If a :file:`.pxd` file is found with the same name as the :file:`.py` file
being compiled, it will be searched for :keyword:`cdef` classes and
:keyword:`cdef`/:keyword:`cpdef` functions and methods. The compiler will
then convert the corresponding classes/functions/methods in the :file:`.py`
file to be of the declared type. Thus if one has a file :file:`A.py`:
:
file to be of the declared type. Thus if one has a file :file:`A.py`:
def myfunction(x, y=2):
a = x-y
return a + x * y
def _helper(a):
return a + 1
class A:
def __init__(self, b=0):
self.a = 3
self.b = b
def foo(self, x):
print(x + _helper(1.0))
and adds :file:`A.pxd`::
.. literalinclude:: ../../examples/tutorial/pure/A.py
cpdef int myfunction(int x, int y=*)
cdef double _helper(double a)
and adds :file:`A.pxd`:
cdef class A:
cdef public int a,b
cpdef foo(self, double x)
.. literalinclude:: ../../examples/tutorial/pure/A.pxd
then Cython will compile the :file:`A.py` as if it had been written as follows::
...
...
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