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

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 17 23:05:18 CET 2013


Gregory Salvan wrote:
> I believe the point of removing assertions is also to avoid throwing 
> unhandled developper errors to end-user

I'm not sure I buy that. An assert is saying that something
should never happen. If it does happen, either it's going
to lead to an exception further down the track, or produce
incorrect results. In the first case, you've failed to
shield the user from exceptions; in the second, better to
log an exception than silently pretend nothing has gone
wrong.

-- 
Greg


More information about the Python-Dev mailing list