Posting partial review. I don't like the proposed API - will comment on the
tracker.
http://bugs.python.org/review/665194/diff/2542/6110
File Doc/library/email.util.rst (right):
http://bugs.python.org/review/665194/diff/2542/6110#newcode102
Doc/library/email.util.rst:102: is used. *timeval* may also be a
:class:`~datetime.datetime` instance. If
Please use naive/aware datetime terminology instead of referring to tzinfo
member.
http://bugs.python.org/review/665194/diff/2542/6110#newcode103
Doc/library/email.util.rst:103: the intsance does not have a
:class:`~datetime.tzinfo`, the behavior is as
Spelling: instance.
http://bugs.python.org/review/665194/diff/2542/6110#newcode104
Doc/library/email.util.rst:104: with a floating point time value. If it does
have a
This is not clear. Floating point value is unambiguous TZ independent "seconds
since epoch". Naive datetime can be either UTC or local.
http://bugs.python.org/review/665194/diff/2542/6111
File Lib/email/utils.py (right):
http://bugs.python.org/review/665194/diff/2542/6111#newcode119
Lib/email/utils.py:119: gmtime() and localtime(), otherwise the current time is
used. timeval
Please don't start sentence with a word that has to be in lowercase. Use
"Argument timeval' or rephrase.
http://bugs.python.org/review/665194/diff/2542/6111#newcode122
Lib/email/utils.py:122: a tzinfo, then localtime and usegmt are ignored and the
output string
I am not sure it is a good idea to further complicate formatdate() function
which already has two constant bool arguments. This is already a design red
flag suggesting that several functions may be a better choice. I would just add
a separate function dedicated to formatting datetime.
http://bugs.python.org/review/665194/diff/2542/6111#newcode138
Lib/email/utils.py:138: elif hasattr(timeval, 'timetuple'):
I would do isinstance(timeval, datetime) instead. Having timetuple method is
not enough for duck typing here. Are there 3rd party date/time classes in the
wild that will work with this implementation?
http://bugs.python.org/review/665194/diff/2542/6111 File Lib/email/utils.py (right): http://bugs.python.org/review/665194/diff/2542/6111#newcode119 Lib/email/utils.py:119: gmtime() and localtime(), otherwise the current time is used. ...