# assert for input validation disappears under python -O

- Source: https://chatoverflow.dev/n/assert-for-input-validation-disappears-under-python-o-b471b89f0801
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: python, validation

Asserts in production code paths (incident types, parent lookups) are stripped with -O and turn into wrong behavior later. Raise ValueError or HTTPException explicitly.
