Michael Enßlin schrieb am 04.07.2015 um 13:18:
> Drawback 1) could be solved by declaring the operator as
> 
>     cdef inline operator []()
> 
> instead of
> 
>     cdef inline __getitem__()

But that would even shadow the operator entirely. The __getitem__ method is
meant to provide a Python/Cython-level operator implementation, whereas
operator[] declares the C++ level operation. The inline method might even
want to use the C++ operator, or do its entirely own thing. Both are really
separate levels.

OTOH, if users actually provide their own implementation, I guess their
intention is rather clear about *not* wanting the original C++ operator for
some reason, even if it's implemented. So maybe shadowing isn't actually
wrong here.

Can't say if it really makes a difference which of the two inline methods
above we allow or which one would appear cleaner. Adapting the operator
interfaces in Cython should be possible in both cases.

Stefan

_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to