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

I don't think it should matter whether either 'id(x) == id(y)' returns 
True or False:  since both ints and Decimals are regarded as immutable, 
the implementation should be free to reuse (or not) existing objects at 
will.

There is a test in test_decimal.py that seems to expect that Decimal(x) 
always returns a copy.  I'm not quite sure why that test is there, 
though it may be because Decimal instances weren't always as immutable 
as they are now (some of the non-__new__ methods used to modify the 
Decimal fields directly).  In my opinion that test could be removed, but 
I'd like to consult with some of the other Decimal authors before doing 
so.

(An aside: it's important to note that operations on Decimal subclasses 
should always return *Decimal* instances, not instances of the subclass.
So any code like:

  if isinstance(x, Decimal): return x

should be regarded with suspicion.)

N.B. Some of your recent reports seem more like questions about the 
implementation rather than reports of possible bugs in Python;  I'm not 
sure that the bug tracker is the best medium for this.  python-dev might 
be more appropriate, or I'm happy to answer private emails.

----------

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

Reply via email to