[SciPy-user] assign to diagonal values?
Anne Archibald
peridot.faceted at gmail.com
Thu Jan 31 10:43:21 EST 2008
On 31/01/2008, william ratcliff <william.ratcliff at 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
with
if not c: raise ValueError
?
Anne
More information about the SciPy-User
mailing list