[SciPy-dev] How to handle exceptional cases in algorithms ? Exception vs Warning
Charles R Harris
Tue Jun 5 12:02:29 CDT 2007
On 6/4/07, Robert Kern <firstname.lastname@example.org> wrote:
> Anne Archibald wrote:
> > Just a, uh, warning: I found that it was very difficult to make the
> > warnings module do what it was documented to do in terms of throwing
> > exceptions and warning the right number of times.
> Can you give an example? I thought it was fairly straightforward. The only
> niggle is interactive use. After the first time a warning is issued (and
> raised as an error), the warning, including its message and the location
> in the
> file, is stored in a registry in the module containing the warn() call.
> Consequently, if you run interactively, see a warnings, set a filter to
> raise an
> exception instead of printing the warning, then try the bad function
> again, you
> don't get an exception.
Yeah, I had that problem too. I just removed the registry storage for
warnings. I think it is a bug, it should be possible to set the number of
times a warning is issued. IIRC, the warnings module claims that this is
possible, but it doesn't work correctly.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scipy-dev