Skip to content

Conversation

@henrykrumb
Copy link

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.

@eigenvivek
Copy link
Owner

hi henry, thanks for the PR! never knew about the -O flag.

I think you just need to run nbdev_clean; nbdev_export and then the tests should pass

apologies for the nbdev framework, I though it was a great idea a few years ago but now i realize how challenging it makes PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants