[Python-Dev] Mixing float and Decimal -- thread reboot (original) (raw)

Raymond Hettinger raymond.hettinger at gmail.com
Wed Mar 24 21:56:14 CET 2010


FWIW, my viewpoint on this is softening over time and I no longer feel a need to push for a new context flag.

It is probably simplest for users if implicit coercions didn't come with control knobs. We already have Fraction+float-->float occurring without any exceptions or warnings, and nothing bad has happened as a result.

Also, I'm reminded of Tim Peter's admonition to resist extending the decimal spec.

I used to worry that any decimal/float interactions were most likely errors and shouldn't pass silently. Now, I've just stopped worrying and I feel better already ;-) Adding a FAQ entry is simpler than building-out Context object circuitry and documenting it in an understandable way.

Raymond

On Mar 24, 2010, at 12:36 PM, Stefan Krah wrote:

Nick Coghlan <ncoghlan at gmail.com> wrote:

Raymond Hettinger wrote:

The decimal module is already drowning in complexity, so it would be best to keep it simple: one boolean flag that if set would warn about any implicit decimal/float interaction.

Agreed - those that want exceptions instead can use the usual warnings module mechanisms to trigger them. I'm not sure about the warnings module. If lower complexity is a goal, I would prefer Facundo's original proposal of just adding a single new signal. Users who just want to know if a NonIntegerConversion has occurred can check the flags, users who want an exception set the trap. With the warnings module, users have to know (and deal with) two exception handling/suppressing mechanisms. Stefan Krah



More information about the Python-Dev mailing list