datetime.rst: improve combine() docs (#101338)

The explanation on handling of datetime as the date arg was confusingly mixed with an unrelated
item, and lacked proper arg name formatting.
This commit is contained in:
John Belmonte 2023-01-26 16:25:43 +09:00 committed by GitHub
parent a2262789ab
commit f5ad63f79a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -982,12 +982,11 @@ 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 date is a
:class:`.datetime` object, its time components and :attr:`.tzinfo` attributes
are ignored.
``d == datetime.combine(d.date(), d.time(), d.tzinfo)``.
.. versionchanged:: 3.6
Added the *tzinfo* argument.