[issue23332] datetime.isoformat() -> explicitly mark UTC string as such

Mirko Vogt report at bugs.python.org
Tue Jan 27 20:32:57 CET 2015


Mirko Vogt added the comment:

Just to clarify my problem - then I'll just happily use datetime.now(tzutc()).isoformat()

 - There is datetime.now() which is supposed to be used (no utcnow() anymore)
 - datetime.now() might return a naive object, when no TZ is specified
 - *However* also the naive variant implements the class isoformat() which is described as "Return a string representing the date in ISO 8601 format"
 - ISO 8601 can and should be understood such as the TZ-designator is required (I think we agreed on that).
 - However isoformat() called on a naive object returns a string with no TZ designator

I would at least suggesting adding a note for isoformat() about being called on naive datetime objects.

----------

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


More information about the Python-bugs-list mailing list