Mark Dickinson <dicki...@gmail.com> added the comment:

Now that I think about it, this could be 'fixed' without breaking compliance:  
all the specification requires is that a power function with the specified 
behaviour is present *somewhere* in the decimal module;  it needn't be linked 
to the ** operator.  So there could be two versions of power in decimal.py:  
one version (called Decimal.power) that strictly conforms to the specification, 
and another (Decimal.__pow__) that's identical in every way except that it 
returns Decimal('1') for Decimal('0.0')**0.

While we're at it, we could also 'fix' Decimal.__pos__ and Decimal.__neg__ 
similarly:  the standard requires operations 'plus' and 'minus', with the 
slightly surprising (to me, at least) properties that plus(-0.0) = 0.0 and 
minus(0.0) = 0.0  (for both these, -0.0 seems more natural);  but there's no 
requirement that Python's __pos__ and __neg__ be identical to these.

But these changes would come with all the usual costs: extra code, tests and 
documentation, future maintenance costs, possibility of introducing bugs, user 
confusion, possible backwards compatibility issues,...  So there would have to 
be some significant perceived benefits to outweigh the costs.

Perhaps a discussion on the python-dev mailing list would be in order?

----------
status: pending -> open

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

Reply via email to