Skip to content

bpo-36138: Improve docs about converting datetime.timedelta to scalars. #12137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 16, 2019
8 changes: 5 additions & 3 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ Supported operations:
| | rounded to the nearest multiple of |
| | timedelta.resolution using round-half-to-even.|
+--------------------------------+-----------------------------------------------+
| ``f = t2 / t3`` | Division (3) of *t2* by *t3*. Returns a |
| | :class:`float` object. |
| ``f = t2 / t3`` | Division (3) of overall duration *t2* by |
| | interval unit *t3*. Returns a :class:`float` |
| | object. |
+--------------------------------+-----------------------------------------------+
| ``t1 = t2 / f or t1 = t2 / i`` | Delta divided by a float or an int. The result|
| | is rounded to the nearest multiple of |
Expand Down Expand Up @@ -351,7 +352,8 @@ Instance methods:
.. method:: timedelta.total_seconds()

Return the total number of seconds contained in the duration. Equivalent to
``td / timedelta(seconds=1)``.
``td / timedelta(seconds=1)``. For interval units other than seconds, use the
division form directly (e.g. ``td / timedelta(microseconds=1)``).

Note that for very large time intervals (greater than 270 years on
most platforms) this method will lose microsecond accuracy.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve documentation about converting datetime.timedelta to scalars.