From 4c26d66b28f5ad00652393bf2385b462e9e8e79b Mon Sep 17 00:00:00 2001 From: John Belmonte Date: Thu, 26 Jan 2023 14:16:29 +0900 Subject: [PATCH 1/3] datetime.rst: improve combine() docs The explanation on handling of `datetime` as the `date` arg was confusingly mixed with an unrelated item, and lacked proper arg name formatting. --- Doc/library/datetime.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index eba8824f835113..9920aecfab30bd 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -985,9 +985,10 @@ Other constructors, all class methods: is used. For any :class:`.datetime` object *d*, - ``d == datetime.combine(d.date(), d.time(), d.tzinfo)``. If date is a - :class:`.datetime` object, its time components and :attr:`.tzinfo` attributes - are ignored. + ``d == datetime.combine(d.date(), d.time(), d.tzinfo)``. + + If the *date* argument is a :class:`.datetime` object, its time components and + :attr:`.tzinfo` attributes are ignored. .. versionchanged:: 3.6 Added the *tzinfo* argument. From 2ec9074dfba396a46dd632f60a83e9f7907e9301 Mon Sep 17 00:00:00 2001 From: John Belmonte Date: Thu, 26 Jan 2023 14:19:43 +0900 Subject: [PATCH 2/3] fix trailing whitespace --- Doc/library/datetime.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 9920aecfab30bd..3527459d978a3b 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -986,7 +986,7 @@ Other constructors, all class methods: For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d.time(), d.tzinfo)``. - + If the *date* argument is a :class:`.datetime` object, its time components and :attr:`.tzinfo` attributes are ignored. From 449f059cc074d2bdd8b6f3a7bc816cd8094675f7 Mon Sep 17 00:00:00 2001 From: John Belmonte Date: Thu, 26 Jan 2023 15:21:42 +0900 Subject: [PATCH 3/3] adjust ordering of text --- Doc/library/datetime.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 3527459d978a3b..ebb5f319efda8d 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -982,14 +982,12 @@ Other constructors, all class methods: are equal to the given :class:`.time` object's. If the *tzinfo* argument is provided, its value is used to set the :attr:`.tzinfo` attribute of the result, otherwise the :attr:`~.time.tzinfo` attribute of the *time* argument - is used. + is used. If the *date* argument is a :class:`.datetime` object, its time components + and :attr:`.tzinfo` attributes are ignored. For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d.time(), d.tzinfo)``. - If the *date* argument is a :class:`.datetime` object, its time components and - :attr:`.tzinfo` attributes are ignored. - .. versionchanged:: 3.6 Added the *tzinfo* argument.