[Python-Dev] Negative timedelta strings (original) (raw)

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Mar 28 17:07:51 CET 2014


On Fri, Mar 28, 2014 at 7:03 AM, Steven D'Aprano <steve at pearwood.info> wrote:

py> str(timedelta(0, -1)) '-1 day, 23:59:59' .. Does anyone remember the rationale for this behaviour?

I don't recall any better rationale than what I wrote in the docs: "String representations of timedelta objects are normalized similarly to their internal representation."

Is it open to debate or is it now cast in stone?

I think the barrier for changing str() is lower than that for changing repr(), but I would be against any changes in this area. (I may have had a different view if ISO 8601 syntax for timedeltas was not so ugly. :-) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140328/b0085646/attachment.html>



More information about the Python-Dev mailing list