[issue30681] email.utils.parsedate_to_datetime() should return None when date cannot be parsed

R. David Murray report at bugs.python.org
Mon Jun 19 13:33:22 EDT 2017


R. David Murray added the comment:

I'll make one argument in favor of retaining the exception, and if that doesn't fly then I agree to the solution and will try to review the PR soon.

The argument is this: if parsedate_to_datetime raises an error, you get information about *why* the date was invalid, which you don't get from a 'None' return.  It is my thought that this would be the most useful behavior for the cases where you call it directly (otherwise, why call it directly?)

(And as far as the doc issue goes, you are correct Barry that the current docs don't document the difference in the error case; I noted in another issue that that "should be fixed"...which is only the case now if you agree to my argument above :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30681>
_______________________________________


More information about the Python-bugs-list mailing list