I am implementing a module in C#. This module does some comparison operations. One of the tests for this module has something like the following:<div><br></div><div>class CmpErr:</div><div>    def __cmp__(self, other):</div>
<div>        raise ZeroDivisionError</div><div><br></div><div>x = [CmpErr(), CmpErr(), CmpErr()]</div><div>cSharpMethod(x)</div><div><br></div><div>Inside cSharpMethod is when I do the comparison. The way I am doing the comparison is taken from how its done in List.cs</div>
<div><br></div><div><pre style="font-family:Consolas;font-size:13;color:#f1f2f3;background:#22282a"><span style="color:#8c8cb4">IComparer</span> comparer <span style="color:#e8e2b7">=</span> <span style="color:#678cb1">PythonContext</span><span style="color:#e8e2b7">.</span>GetContext(context)<span style="color:#e8e2b7">.</span>GetComparer(<span style="color:#93c763">null</span>, GetComparisonType(context, list));
</pre><div>Then I call comparer.Compare on the two items. In List.sort, this eventually calls the __cmp__ method if I try adding a call to x.sort() instead of cSharpMethod, but from inside cSharpMethod, __cmp__ is never called and I can&#39;t figure out why. </div>
<div><br></div><div>Any ideas on why this might be occuring?</div><div><br></div><div>Thanks,</div><div><br></div><div>slide</div><div><br></div>-- <br>Website: <a href="http://earl-of-code.com" target="_blank">http://earl-of-code.com</a><br>

</div>