Author lemburg
Recipients andrei.duma, belopolsky, ezio.melotti, gvanrossum, haypo, lemburg, r.david.murray, skip.montanaro, terry.reedy, tim.peters
Date 2013-11-05.21:32:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <527963DD.6010007@egenix.com>
In-reply-to <CAMpsgwY=xps5G6-Bm67REauZfvytAJzj6-M66dG8PHiNbyCMmA@mail.gmail.com>
Content
On 05.11.2013 21:31, STINNER Victor wrote:
> 
> 2013/11/5 Alexander Belopolsky <report@bugs.python.org>:
>> +1 on adding an option to isoformat().  We already have an optional <sep> argument, so the symmetry with __str__ is not complete.  To make this option more useful, rather than implementing always_emit_microseconds=False flag, I would add a keyword argument 'precision' that would take ('hour'|'minute'|'second'|millisecond'|'microsecond') value.
> 
> Hour precision is not part of the ISO 8601 standard.
> 
> "resolution" is maybe a better name for the new parameter than "precision":
> http://www.python.org/dev/peps/pep-0418/#glossary
> 
> The new parameter should be added to datetime.datetime.isoformat() but
> also datetime.time.isoformat().

Since this ticket is about being able to remove the seconds fraction
part, I think it's better to use a name that is not already overloaded
with other meanings, e.g. show_us=False or show_microseconds=False.

BTW: Have you thought about the rounding/truncation issues
associated with not showing microseconds ?

A safe bet is truncation, but this can lead to inaccuracies of
up to a second. Rounding is difficult, since it can lead to
a "60" second value showing up for e.g. 11:00:59.95 seconds,
or the need to return "12:00:00" for 11:59:59.95.
History
Date User Action Args
2013-11-05 21:32:18lemburgsetrecipients: + lemburg, gvanrossum, tim.peters, skip.montanaro, terry.reedy, belopolsky, haypo, ezio.melotti, r.david.murray, andrei.duma
2013-11-05 21:32:18lemburglinkissue19475 messages
2013-11-05 21:32:18lemburgcreate