[Python-Dev] Adding decimal (aka FixedPoint) numbers to Python

Martin v. Löwis martin@v.loewis.de
15 Dec 2002 10:13:48 +0100


Brett Cannon <bac@OCF.Berkeley.EDU> writes:

> Someone will correct me if I am wrong, but making a new decimal type that
> includes a new suffix for numbers is  going to require a PEP.  Your
> email, though, already seems like a rather good start for one and should
> not require much more work.

That is certainly the case (both the need for a PEP, and that the
message is a good starting point). While the technical aspects of the
proposed changes look fine, I'm missing a rationale: why is having
decimal literals in the language a good thing? [this is not to say
they aren't, but it may not be obvious]

> It would be easier to get the module itself sans any Python core changes
> accepted initially to gauge usage and interest by the Python community
> before pushing for syntax integration.  This is what is be done with the
> current rational implementation.

It also appears that a decimal type feature in the language will/should
interact with a rational type.

I don't know whether the current rational type proposals suggests
introduction of new literals, but I feel that the only rational
literals you'll ever need are decimals (and we all know that
floating-point literals are decimal rationals, too). So it might be
that we *only* get the decimal notation from this proposal, and not a
proper decimal type.

Of course, my CORBA affinity tells me that a decimal type would
be useful as well :-)

Regards,
Martin