Re: [Cython] Make 'inline' methods in cdef-class non-overridable?
Robert Bradshaw, 07.01.2010 22:06:
> On Jan 7, 2010, at 12:34 PM, Neil Ludban wrote:
>> Classes defined in extensions must explicitly indicate that they
>> support subclassing from pure Python. NoneType and bool are core
>> types that don't, there may be others.
> Ah, I did not know that. That does make a final modifier more
> attractive. This is a larger change to the language than allowing
> inline methods (with an error if one attempts to override them).
I'm +0 on 'final' classes. I don't see a major use case, although there may
be. Some extension types are really just meant as containers for C types,
and when they are created from module internal code only, there may not be
much value in subtyping them (although lxml.etree makes a good counter
Anyway, if it's supported by CPython, it should be ok to support it in
Cython, I guess, as long as users are aware that this really means that
they put a serious restriction on the usage of their code, and that this
should be used with caution.
I certainly have seen enough Java code where 'final' was getting in the way
at some point (and wasn't easy to remove from externally maintained code),
or where the keyword was used totally arbitrarily in places where the
compiler can easily infer the semantics anyway, and where it just adds
noise to the code. I always expect an important intention when I see this
keyword in code, and when there isn't one, it tends to confuse me, because
it doesn't give me the feeling that I have understood the code.