On Mon, Mar 10, 2014 at 10:16 AM, Oscar Benjamin wrote: On 10 March 2014 08:32, Mark Dickinson Another option would be to change the behaviour of + and - on Decimal
objects by binding `__pos__` and `__neg__` to the specification's 'copy' and 'copy-negate' operations instead of (as currently) to the 'plus' and
'minus'
operations. Those behaviours are more in keeping with the way that +
and -
operate on other objects. Hi Mark and thanks for responding, Do you think it's really feasible to make such a change? Probably not. :-( As you point out, there are significant backward
compatibility issues. It's the solution I'd adopt if those concerns didn't
exists, and the one I'd still look for a way to get to even *with* those
concerns, but the level of breakage may make this out of the question. I
doubt we're going to get to Decimal literals without breaking at least
*some* code, but this may be too much breakage.
I guess I have ulterior motives; (ab)using '+' to mean 'round to the
current context' has always felt way too implicit for my tastes, and I'd
jump at the chance to see it go away. The unconventional behaviour with
respect to signed zeros bugs me, too. -0.0 -0.0 -Decimal(0.0) # negative sign mysteriously disappears. Decimal('0')
It's perfectly legitimate, and part of the standard, but ... ugh. I argued
with Mike Cowlishaw about it at one point. I lost.
Mark