On 6/5/2012 3:17 PM, Guido van Rossum wrote:
On Tue, Jun 5, 2012 at 12:15 PM, Alexander Belopolsky
<alexander.belopol...@gmail.com>  wrote:
On Tue, Jun 5, 2012 at 3:01 PM, Antoine Pitrou<solip...@pitrou.net>  wrote:
You could say the same about equally "confusing" results, yet equality never
raises TypeError (except between datetime instances):

() == []
False

And even closer to home,

date(2012,6,1) == datetime(2012,6,1)
False

I agree, equality comparison should not raise an exception.

Let's make it so.

3.3 enhancement or backported bugfix? The doc strongly suggests that rich comparisons should return *something* and by implication, not raise. In particular, return NotImplemented instead of raising a TypeError for mis-matched arguments.

"A rich comparison method may return the singleton NotImplemented if it does not implement the operation for a given pair of arguments. By convention, False and True are returned for a successful comparison. However, these methods can return any value,"

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to