This blog post addresses in the CPython repository, which focuses on extending the deprecation warning period for bitwise inversion on boolean types in Python.
Rapidly turning a warning into a hard error can break environments. A longer warning period ensures developers see the notice without their builds immediately failing. 122982
is_active = True status = ~is_active # Returns -2, triggers warning Use code with caution. Copied to clipboard is_active = True status = not is_active # Returns False Use code with caution. Copied to clipboard Conclusion This blog post addresses in the CPython repository,
It allows more time for the community to discuss if there are specific edge cases where bitwise inversion on bool remains necessary. How to Prepare Your Code is_active = True status = ~is_active # Returns
Python Development Update: Extending the Deprecation Warning for ~bool (Issue #122982)