[issue7342] str(datetime_obj) doesn't include microseconds if their value is 0

Ezio Melotti report at bugs.python.org
Fri Nov 20 08:08:52 CET 2009


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

If __str__ is supposed to produce "nice" output, the microsecond shouldn't 
be visible at all imho (special cases are not special enough to break the 
rules).
If the date/time object is read by a human he probably doesn't care of 
the microseconds anyway, if it's parsed by a machine the '0 microseconds' 
situation must be special-cased to avoid failures like the one mentioned in 
the first message.
The fact that the documentation of datetime.isotime() mentions it is not 
enough if the user doesn't know that it's used by str(), so a note should be 
added to the doc.
I don't know if/how the situation can be fixed though.

----------

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


More information about the Python-bugs-list mailing list