Commit 28bb1ffd authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2329 from gabrieldemarmiesse/test_cdef_classes_1

Added tests for cdef_classes.rst.
parents fa4c43b9 7560a9e7
class MathFunction(object):
def __init__(self, name, operator):
self.name = name
self.operator = operator
def __call__(self, *operands):
return self.operator(*operands)
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment