How do I disable assertions and docstrings, respectively, in an IPython session or a Jupyter Notebook?
After the official python documentation, this stackoverflow question and this answer to a similar question, I may “set the PYTHONOPTIMIZE environment variable to 1”. Well, if I set the environment variable following this blog post via
%env PYTHONOPTIMIZE=1
I can successfully list the value along all other variables with %env, but still unexpectedly __debug__ == True and AssertionErrors are raised. Different values like 2 or a string "1" weren't successful, either.
Bonus question: Is it possible to disable assert only for a specific (local) library, like after using import myfancylib, myfancylib.eggs() won't raise?