summaryrefslogtreecommitdiffstats
path: root/Doc/library/datetime.rst
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-05-31 17:33:47 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-05-31 17:33:47 (GMT)
commit1790bc43bf8430b219116f4af0423c3a732c9eb8 (patch)
tree57771b07db60bebd3fb1d038fb7c5c541f3dcb6e /Doc/library/datetime.rst
parent9103597ee7e318f5c7183a1b1c97e5322f1f77aa (diff)
downloadcpython-1790bc43bf8430b219116f4af0423c3a732c9eb8.zip
cpython-1790bc43bf8430b219116f4af0423c3a732c9eb8.tar.gz
cpython-1790bc43bf8430b219116f4af0423c3a732c9eb8.tar.bz2
Issue #1289118: datetime.timedelta objects can now be multiplied by float
and divided by float and int objects.
Diffstat (limited to 'Doc/library/datetime.rst')
-rw-r--r--Doc/library/datetime.rst14
1 files changed, 12 insertions, 2 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 908a792..2a90e42 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -220,12 +220,20 @@ Supported operations:
| | In general, *t1* \* i == *t1* \* (i-1) + *t1* |
| | is true. (1) |
+--------------------------------+-----------------------------------------------+
+| ``t1 = t2 * f or t1 = f * t2`` | Delta multiplied by a float. The result is |
+| | 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. |
+--------------------------------+-----------------------------------------------+
+| ``t1 = t2 / f or t1 = t2 / i`` | Delta divided by a float or an int. The result|
+| | is rounded to the nearest multiple of |
+| | timedelta.resolution using round-half-to-even.|
++--------------------------------+-----------------------------------------------+
| ``t1 = t2 // i`` or | The floor is computed and the remainder (if |
| ``t1 = t2 // t3`` | any) is thrown away. In the second case, an |
-| | integer is returned (3) |
+| | integer is returned. (3) |
+--------------------------------+-----------------------------------------------+
| ``t1 = t2 % t3`` | The remainder is computed as a |
| | :class:`timedelta` object. (3) |
@@ -267,7 +275,9 @@ objects (see below).
.. versionadded:: 3.2
Floor division and true division of a :class:`timedelta` object by
another :class:`timedelta` object are now supported, as are
- remainder operations and the :func:`divmod` function.
+ remainder operations and the :func:`divmod` function. True
+ division and multiplication of a :class:`timedelta` object by
+ a :class:`float` object are now supported.
Comparisons of :class:`timedelta` objects are supported with the