Message78843
Mark wrote:
>> Also, why not just extend the Decimal() constructor to accept
>> a float as the argument? Why have a separate from_float()
>> method at all?
>
> This was discussed extensively when the decimal module was
> being proposed; see the Decimal PEP for arguments against this.
I'm very aware of that. The Decimal PEP says the consensus was for
from_float() to take a second argument specifying the precision.
Decimal(1.1) => Decimal("1.1") was rejected for the reasons given in
the PEP by Paul Moore, and Decimal(1.1) =>
Decimal('110000000000000008881784197001252...e-51') was (presumably)
rejected because it would confuse newbies. Hence the decision to (1)
make an alternative constructor and (2) have it take a second
argument.
It looks like you and Raymond have rejected #2 but are keeping #1, and
I'm curious why. That's genuine curiosity, and a real question, not a
thinly-veiled scowl of disapproval disguised as a question :)
Anyway, I'm happy enough so long as Raymond's suggested
Context.create_decimal() exists, that's the actual functionality I'm
after, so maybe I should let you guys get on with it. Thanks. |
|
Date |
User |
Action |
Args |
2009-01-02 17:08:26 | steven.daprano | set | recipients:
+ steven.daprano, rhettinger, mark.dickinson |
2009-01-02 17:08:26 | steven.daprano | set | messageid: <1230916106.3.0.455479805252.issue4796@psf.upfronthosting.co.za> |
2009-01-02 17:08:25 | steven.daprano | link | issue4796 messages |
2009-01-02 17:08:25 | steven.daprano | create | |
|