- Status: Wanted
- Implementation status: Not started
- Comments: This is part of [:DagSverreSeljebotn]'s GSoC 2008 project proposal
The former is about declaring the capabilities of the type C-side while the latter will be about declaring what Cython-code should be generated when hitting operators.
The former case is not discussed here, see [:enhancements/cpp: the C++ page]. For the latter case, Python-like syntax is proposed:
cdef class Foo: cdef Foo __add__(self, Foo other): return add_foo(self, other)
add_foo might here be either a declared C function or more Cython code. On this level, any kind of fancy parameters for  is supported, by writing the obvious Cython code to interpret the argument list (as a Python tuple structure).
The normal set of Python binary operators, getitem, setitem etc.
Also some Cython-specific operators are probably wanted for controlling coercion behaviour etc. (similar to C++ cast operators).
The return type of the getitem operator (the operator for ) is a problem because it is esentially used for both looking up an element in a collection and for getting slices, and the return type of the former will typically be different from the latter.