Commit 96b2d936 authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2420 from gabrieldemarmiesse/test_language_basics_8

Added tests for "language basics" part 8
parents 3f67bcff 0562dde8
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")
...@@ -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.
......
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