Stefan Krah <stefan-use...@bytereef.org> added the comment:

I'm new to this thread, so I hope I didn't miss anything that has been
said already. I don't fully understand why TypeError cannot be raised
in 2.x. The 2.6 documentation for tp_richcompare says:

"If you want to implement a type for which only a limited set of comparisons 
makes sense (e.g. == and !=, but not < and friends), directly raise TypeError 
in the rich comparison function."


I just tried that in the 2.7 version of cdecimal, and it works well:


>>> from cdecimal import *
>>> Decimal(9) < 2.5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: conversion from float to Decimal is not supported

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2531>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to