On 2015-03-03 18:07, Simon King wrote:
> Then a metaclass will not help you, as it is not supported by Cython
> extension classes.
Yes indeed, __metaclass__ doesn't do anything in Cython.
The problem I am facing in #17890 is that currently, when a Python(!)
class defines __cmp__ and _cmp_, then __cmp__ takes priority. That's the
way how things are in done in Sage currently. The problem is that the
check for __cmp__ is a lot slower than the check for _cmp_ (the latter
is a Cython call). There are some very ugly hacks to speed this up
anyway and I would like to get rid of these hacks.
Ideally, _cmp_ should have priority over __cmp__. This will break
inheritance chains like
Element > A > B
where A is a Cython class with _cmp_ and B is a Python class with
__cmp__. In these cases, one would need to define _cmp_ also for B.