[Python-ideas] Settable defaulting to decimal instead of float

Paul Moore p.f.moore at gmail.com
Thu Jan 12 05:30:04 EST 2017


On 12 January 2017 at 09:04, George Fischhof <george at fischhof.hu> wrote:
> Hi There,
>
> Settable defaulting to decimal instead of float
>
> It would be good to be able to use decimal automatically instead of float if
> there is a setting. For example an environment variable or a flag file.
>
> Where and when accuracy is more important than speed, the user could set
> this flag, and calculate with decimal numbers as learned in the school.
>
> I think several people would use this function
>
> Best regards,
> George

If by "defaulting" you mean having floating point literals default to
decimal, this has been discussed before and would break a lot of code,
so is realistically not going to happen. If that's not what you mean,
pretty much everything else can be done in your code (use "Decimal()"
in place of "float()", etc).

It's unlikely that there's a practical suggestion here that hasn't
been discussed before and rejected, but if you have something specific
to suggest, then you'll have to clarify your proposal with a lot more
detail. But I wouldn't bother unless you can also demonstrate that
your proposal avoids breaking backward compatibility (and "users can
choose whether to use it via a flag" isn't sufficient - it doesn't
help library modules for instance) as it will have no chance of being
accepted unless it's backward compatible.

Regards,
Paul


More information about the Python-ideas mailing list