The TimeDelta class is derived from the Time class and shares many of its
You could specify the return value type annotations in the docstring of a convert()/to_unit() method, or for each to_unit() method. Are they all floats? div and floordiv are not going away. Without reading the docs, I, too, wouldn't have guessed that division by the desired unit is the correct way. In terms of performance, a convert()/to_unit() method must do either a hash lookup or multiple comparisons to present a more useful exception than that returned by initializing timedelta with something like nanoseconds=. FWIW, astropy.time.TimeDelta supports sub-nanosecond precision and has a .to() method for changing units/quantities. http://docs.astropy.org/en/stable/time/#time-deltas properties. One difference is that the time scale has to be one for which one day is exactly 86400 seconds. Hence, the scale cannot be UTC.
The available time formats are:
Format Class sec TimeDeltaSec jd TimeDeltaJD datetime TimeDeltaDatetime
http://docs.astropy.org/en/stable/api/astropy.time.TimeDelta.html#astropy.ti... http://docs.astropy.org/en/stable/_modules/astropy/time/core.html#TimeDelta.... On Thursday, February 28, 2019, Alexander Belopolsky < alexander.belopolsky@gmail.com> wrote:
while "some_var / some_other_var" could be doing anything.
"At an elementary level the division of two natural numbers is – among other possible interpretations – the process of calculating the number of times one number is contained within another one."
-- https://en.wikipedia.org/wiki/Division_(mathematics)
The process of figuring out how many seconds fit into a given interval is called division by a second.
I am afraid people who get confused by timedelta / timedelta division know too much about Python where / can indeed mean anything including e.g. joining filesystem paths.