Re: [cython-users] final (inline) cpdef method in a non-final class?

191 views
Skip to first unread message

Robert Bradshaw

unread,
Nov 21, 2012, 6:20:09 PM11/21/12
to cython...@googlegroups.com
On Wed, Nov 21, 2012 at 2:59 PM, Volker Braun <vbrau...@gmail.com> wrote:
> Cython 0.17.2 doesn't accept that and emits "Only final types can have final
> Python (def/cpdef) methods". But
> http://trac.cython.org/cython_trac/ticket/586 suggests that "final" methods
> in non-final cdef classes should work. Bug or feature? That is, should I
> open a ticket or is it intentional? I would have thought that its ok to have
> final methods, the only error I would have expect is when I try to override
> them in a derived class (which is Cython's "Overriding final methods is not
> allowed" error).

The issue is how to prevent them from being overridden in Python
(which is not unsolveable, could probably be done pretty easily with a
metaclass). It's intentional that we disallow it before such a
mechanism is in place, but worth filing a ticket to add this feature.

- Robert

Volker Braun

unread,
Nov 24, 2012, 7:19:50 AM11/24/12
to cython...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages