[New-bugs-announce] [issue7845] complex.__lt__ should return NotImplemented instead of raising TypeError
Mark Dickinson
report at bugs.python.org
Wed Feb 3 14:58:36 CET 2010
New submission from Mark Dickinson <dickinsm at gmail.com>:
Currently in py3k, order comparisons for complex numbers raise a TypeError. This was necessary in Python 2.x in order to make a complex <-> complex comparison raise an exception. In 3.x, it's no longer necessary, since if both sides of a comparison return NotImplemented the result of the comparison is a TypeError (in 2.x the result is a value based on comparing the ids).
In py3k, complex.__lt__ could be changed to always return NotImplemented. This would allow a custom class to implement its own comparisons with complex, and would remove an unnecessary special case.
----------
assignee: mark.dickinson
components: Interpreter Core
messages: 98783
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: complex.__lt__ should return NotImplemented instead of raising TypeError
type: behavior
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7845>
_______________________________________
More information about the New-bugs-announce
mailing list