Alexander Belopolsky added the comment:

Do I understand correctly that the request is to append '+00:00' to the result 
of dt.isoformat() when dt is naive?  If so, -1.  Python's datetime module does 
not dictate how naive datetime instances should be interpreted.  UTC by default 
and local by default are both valid choices, but local by default is often 
preferable.  There are at least two reasons for that:

1. Local time is the "naïve" time.  Using UTC implies certain amount of 
sophistication.

2. Interpreting naive times as UTC is unnecessary because it is very easy to 
create aware instances with tzinfo=timezone.utc.

When communicating with javascript and in general when writing software for the 
Internet, I recommend using aware datetime instances.  For example,

>>> from datetime import *
>>> datetime.now(timezone.utc).isoformat()
'2015-01-27T18:27:33.216857+00:00'

----------
type: behavior -> enhancement
versions: +Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23332>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to