On 2022-04-19, Loris Bennett <loris.benn...@fu-berlin.de> wrote: > I now realise that timedelta is not really what I need. I am interested > solely in pure periods, i.e. numbers of seconds,
That's exactly what timedelta is. > that I can convert back and forth from a format such as > > 11-22::44:55 I don't recognise that format and can't work out what it means. It should be trivial to write functions to parse whatever format you wanted and convert between it and timedelta objects though. > It is obviously fairly easy to rustle up something to do this, but I am > surprised that this is not baked into Python (such a class also seems to > be missing from R). I would be very surprised if any language supported the arbitrary format above you happen to be interested in! > I would have thought that periods crop up all over > the place and therefore formatting as strings and parsing of string > would be supported natively by most modern languages. Apparently not. I think most languages think that a simple number suffices to represent a fixed time period (commonly seconds or milliseconds). And if you want more dynamic intervals (e.g. x months y days) then there is insufficient consensus as to what that actually means. -- https://mail.python.org/mailman/listinfo/python-list