[Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

Maciej Fijalkowski fijall at gmail.com
Sat Nov 16 14:17:33 CET 2013

On Sat, Nov 16, 2013 at 3:51 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> http://bugs.python.org/issue19562
> propose to change the first assert in Lib/datetime.py
>   assert 1 <= month <= 12, month
> to
>   assert 1 <= month <= 12,'month must be in 1..12'
> to match the next two asserts out of the *53* in the file. I think that is
> the wrong direction of change, but that is not my question here.
> Should stdlib code use assert at all?
> If user input can trigger an assert, then the code should raise a normal
> exception that will not disappear with -OO.

May I assert that -OO should instead be killed?

More information about the Python-Dev mailing list