[SciPy-user] assign to diagonal values?

Anne Archibald peridot.faceted@gmail....
Thu Jan 31 09:43:21 CST 2008

On 31/01/2008, william ratcliff <william.ratcliff@gmail.com> wrote:
> Just curious--is it safe to use the assert statement for anything beyond
> debugging in case someone actually runs with optimization?

If debugging is turned off, then the condition in assert is not checked. So no.

More importantly, AssertionErrors *mean* that there is a bug in your
program. Not that it got invlaid input, not that it's out of some
resource, they mean your program has a bug. So it's okay to turn them
off if you're in a hurry, because a properly-working program never
signals AssertionError no matter what you feed it.

And really, how hard is it to replace

assert c


if not c: raise ValueError



More information about the SciPy-user mailing list