On Jan 7, 2010, at 9:50 AM, Stefan Behnel wrote:
> 
>> @cython.nonvirtual
>> @cython.inline
>> cdef void small_method(self, x):
>>    pass
> 
> But wouldn't '@cython.inline' still imply '@cython.nonvirtual' here?
> 
> The question is: what use case is there where you would want one without 
> the other?
> 
> Stefan

First use case: a super-optimizing cython would look for methods
that make many calls to inline non-final methods and generate two
code paths depending on whether self is exactly this class.  Of
course, inline would also be automatically detected.

Second use case: other languages use "final" as a software design
technique (not an optimization), but that would be adding a new
feature to Python, probably not the intended goal.

Using "final" still seems much less evil than surprising end users
with unexpected (vs C/C++ and Python) semantics for "inline".

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to