[Python-ideas] Consider generalizing Decimal to support arbitrary radix

Chris Angelico rosuav at gmail.com
Wed Feb 7 16:56:06 EST 2018

On Thu, Feb 8, 2018 at 8:49 AM, Neil Girdhar <mistersheik at gmail.com> wrote:
> Arbitrary radix comes up every now and then and Decimal already has a
> radix() method.  It would be nice when initializing a Decimal object to be
> able to specify an arbitrary radix>=2.

The radix method always returns 10, because decimal.Decimal always
operates in base 10. Are you looking for a way to change the way
arithmetic is done, or are you looking for a way to construct a
Decimal from a string of digits and an arbitrary base (the way
int("...", x) does)?


More information about the Python-ideas mailing list