DiffDRR icon indicating copy to clipboard operation
DiffDRR copied to clipboard

Fix walrus operator in assert statement, leading to problems with optimized code

Open henrykrumb opened this issue 2 months ago • 1 comments

Using the optimization flag -O with the Python interpreter eliminates assert statements. Thus, asserts should have no side-effects.

This small PR moves the inline assignment operator (walrus) out of an assert-statement to make it free of side-effects, so that it can be run in deployments where the -O flag is used.

Change is applied both in the original notebook and exported python module code.

henrykrumb avatar Dec 18 '25 14:12 henrykrumb