Open butlerpd opened 1 year ago
Shouldn't really be relying on assert statements these days and they should be turned off in deployed code. If it's "user facing" (including packages used for scripting) it should raise an exception instead, and have type hints that indicate not giving it None.
Nothing "these days" about it. Even in python 2.0 the -O
option stripped assert statements from running code.
That's still the only thing it does.* We don't gain any performance if we convert asserts to conditionals, so there is no reason for us to run the program with -O
and no need to convert the asserts.
It might matter if sascalc were a library where we no longer have control over the execution environment.
* -O
also sets __debug__ = False
.
https://github.com/SasView/sasview/blob/8ccf562c8d593ababc1d010e3adc632f04037dea/src/sas/sascalc/fit/BumpsFitting.py#L291
to
Originally posted by @pkienzle in https://github.com/SasView/sasview/issues/2451#issuecomment-1480324231