[Cython] non-virtual methods

Robert Bradshaw robertwb at math.washington.edu
Wed Aug 24 21:06:50 CEST 2011


On Wed, Aug 24, 2011 at 12:00 PM, Vitja Makarov <vitja.makarov at gmail.com> wrote:
> Recently I used cython in my project and I came with idea that
> sometimes virtual methods are overkill.
>
> What's about adding non-virtual decorator for c[p]def methods?
>
> cdef class Foo:
>     @cython.nonvirtual
>     cpdef int is_active(self):
>             return clib.obj_is_active(self._cobj)

We have toyed with the idea of using a "final" modifier. Note that
this would only work for a final class or a pure cdef method.

- Robert


More information about the cython-devel mailing list