Steven D'Aprano <[email protected]> added the comment:
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.
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue4796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com