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
28bb1ffd
Commit
28bb1ffd
authored
Jun 15, 2018
by
scoder
Committed by
GitHub
Jun 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2329 from gabrieldemarmiesse/test_cdef_classes_1
Added tests for cdef_classes.rst.
parents
fa4c43b9
7560a9e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
docs/examples/tutorial/cdef_classes/math_function.py
docs/examples/tutorial/cdef_classes/math_function.py
+7
-0
docs/src/tutorial/cdef_classes.rst
docs/src/tutorial/cdef_classes.rst
+2
-8
No files found.
docs/examples/tutorial/cdef_classes/math_function.py
0 → 100644
View file @
28bb1ffd
class
MathFunction
(
object
):
def
__init__
(
self
,
name
,
operator
):
self
.
name
=
name
self
.
operator
=
operator
def
__call__
(
self
,
*
operands
):
return
self
.
operator
(
*
operands
)
docs/src/tutorial/cdef_classes.rst
View file @
28bb1ffd
...
...
@@ -2,15 +2,9 @@ Extension types (aka. cdef classes)
===================================
To support object-oriented programming, Cython supports writing normal
Python classes exactly as in Python:
:
Python classes exactly as in Python:
class MathFunction(object):
def __init__(self, name, operator):
self.name = name
self.operator = operator
def __call__(self, *operands):
return self.operator(*operands)
.. literalinclude:: ../../examples/tutorial/cdef_classes/math_function.py
Based on what Python calls a "built-in type", however, Cython supports
a second kind of class: *extension types*, sometimes referred to as
...
...
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