extend methods of decimal module
Steven D'Aprano
steve at pearwood.info
Fri Feb 28 02:34:27 EST 2014
On Fri, 28 Feb 2014 16:00:10 +1100, Chris Angelico wrote:
> If we had some other tag, like 'd', we could actually construct a
> Decimal straight from the source code. Since source code is a string,
> it'll be constructed from that string, and it'll never go via float.
Now that Python has a fast C implementation of Decimal, I would be happy
for Python 4000 to default to decimal floats, and require special syntax
for binary floats. Say, 0.1b if you want a binary float, and 0.1 for a
decimal.
But for now, backwards-compatibility requires that the default floating
point type remains binary float. But we could maybe agitate for a 1.234d
Decimal literal type. Care to write a PEP?
:-)
> The question is how far Python wants to bless the Decimal type with
> syntax - after all, if Decimal can get a literal notation, why can't
> Fraction, and why can't all sorts of other types? And that's a huge can
> of worms.
I like Fractions, but I don't think they're important enough for the
average users to require literal notation.
--
Steven
More information about the Python-list
mailing list