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
96b2d936
Commit
96b2d936
authored
6 years ago
by
scoder
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2420 from gabrieldemarmiesse/test_language_basics_8
Added tests for "language basics" part 8
parents
3f67bcff
0562dde8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
docs/examples/userguide/language_basics/override.pyx
docs/examples/userguide/language_basics/override.pyx
+13
-0
docs/src/userguide/language_basics.rst
docs/src/userguide/language_basics.rst
+2
-14
No files found.
docs/examples/userguide/language_basics/override.pyx
0 → 100644
View file @
96b2d936
from
__future__
import
print_function
cdef
class
A
:
cdef
foo
(
self
):
print
(
"A"
)
cdef
class
B
(
A
):
cpdef
foo
(
self
):
print
(
"B"
)
class
C
(
B
):
# NOTE: not cdef class
def
foo
(
self
):
print
(
"C"
)
This diff is collapsed.
Click to expand it.
docs/src/userguide/language_basics.rst
View file @
96b2d936
...
@@ -510,21 +510,9 @@ Overriding in extension types
...
@@ -510,21 +510,9 @@ Overriding in extension types
When subclassing an extension type with a Python class,
When subclassing an extension type with a Python class,
``def`` methods can override ``cpdef`` methods but not ``cdef``
``def`` methods can override ``cpdef`` methods but not ``cdef``
methods:
:
methods:
from __future__ import print_function
.. literalinclude:: ../../examples/userguide/language_basics/override.pyx
cdef class A:
cdef foo(self):
print("A")
cdef class B(A):
cpdef foo(self):
print("B")
class C(B): # NOTE: not cdef class
def foo(self):
print("C")
If ``C`` above would be an extension type (``cdef class``),
If ``C`` above would be an extension type (``cdef class``),
this would not work correctly.
this would not work correctly.
...
...
This diff is collapsed.
Click to expand it.
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