Skip to content

Conversation

NXPY123
Copy link

@NXPY123 NXPY123 commented May 21, 2024

The current simple_stmts.html#the-assert-statement text mentions -O as a tiny hyperlink over to #cmdoption-O but doesn't mention the PYTHONOPTIMIZE environment variable. This commit adds a hyperlink to it and adds a note warning of breaking logic when using assert statements in code. Fixes #115177


📚 Documentation preview 📚: https://cpython-previews--119305.org.readthedocs.build/

NXPY123 added 2 commits May 21, 2024 13:40
… asserts in assert statement documentation

* The current simple_stmts.html#the-assert-statement text mentions -O as a tiny hyperlink over to #cmdoption-O but doesn't mention the PYTHONOPTIMIZE environment variable. This commit adds a hyperlink to it.
…ssues with code containng assert statements when optimization is enabled

Added a remainder that logic could break when optimization is enabled when using assert statements in code. Mentioned that it's considered best practice to not use assert statements to evaluate function variables.
@ghost
Copy link

ghost commented May 21, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Improve the assert statement documentation to clarify impact of -O and optimization
2 participants