[Python-Dev] Decimal <-> float comparisons in py3k.
dickinsm at gmail.com
Tue Mar 16 18:07:48 CET 2010
On Tue, Mar 16, 2010 at 4:41 PM, Guido van Rossum <guido at python.org> wrote:
> I'd say if you're not going to forward-port this to Python 3, it
> shouldn't go into Python 2 -- in that case it would make more sense to
> me to back-port the exception-raising behavior.
That's also a possible solution, and the one that I'd personally be
happiest with. The main problem is that this has the potential to
break code: lists containing both floats and Decimals are sortable in
2.6, but would no longer be sortable in 2.7. If such breakage is
deemed acceptable then I'd happily backport the exception; I really
don't have a good feeling for how much real-world code could break, if
> Also supporting comparisons but not other mixed operations is going to
> be confusing. If you are sticking to that behavior I think mixed
> comparisons should also be ruled out.
Confusing, yes, but at least not bug-prone. The current 2.x behaviour
has provoked complaints from a number of different people in various
different fora (I recently saw this come up on StackOverflow), and
after initially being skeptical I'm now convinced that it would be a
good idea to change it if at all possible.
More information about the Python-Dev