On Sun, Mar 21, 2010 at 4:16 PM, Raymond Hettinger <raymond.hettin...@gmail.com> wrote: > > On Mar 21, 2010, at 3:59 PM, Steven D'Aprano wrote: > >> On Mon, 22 Mar 2010 06:31:57 am Raymond Hettinger wrote: >>> I really like Guido's idea of a context flag to control whether >>> mixing of decimal and binary floats will issue a warning. >>> The default should be to issue the warning (because unless >>> you know what you're doing, it is most likely an error). >> >> When you say "warning", do you mean warning.warn(), or an exception? > > > I'm not sure I understand your question. I did mean warnings.warn(). > But that does raise a catchable exception or it can be suppressed > through the warnings module. It should probably be set to > warn no more than once.
I would hope it could use whatever mechanism is already used for other conditions in the decimal module such as Underflow, Inexact, Rounded etc. But I have to admit I don't know exactly what those do. It appears they can either raise an exception or call a handle() method on the given exception. Are you thinking of putting the warn() call inside that handle() method? -- --Guido van Rossum (python.org/~guido) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com