Message95030
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. |
|
Date |
User |
Action |
Args |
2009-11-08 00:14:45 | mark.dickinson | set | recipients:
+ mark.dickinson, skrah |
2009-11-08 00:14:45 | mark.dickinson | set | messageid: <1257639285.87.0.108618121853.issue7278@psf.upfronthosting.co.za> |
2009-11-08 00:14:44 | mark.dickinson | link | issue7278 messages |
2009-11-08 00:14:43 | mark.dickinson | create | |
|