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
881d2c05
Commit
881d2c05
authored
Jun 14, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put a A.py and A.pxd from "pure python mode" in the examples directory for testing.
parent
5fadf79e
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 @
881d2c05
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 @
881d2c05
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 @
881d2c05
...
...
@@ -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