8000 gh-115684: Clarify datetime `replace` documentation by davidlowryduda · Pull Request #116519 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115684: Clarify datetime replace documentation #116519

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 3 commits into from
Mar 24, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ Instance methods:

.. method:: date.replace(year=self.year, month=self.month, day=self.day)

Return a date with the same value, except for those parameters given new
values by whichever keyword arguments are specified.
Return a new date with the same values, except with new values for
those parameters given by whichever keyword arguments are specified.

Example::

Expand Down Expand Up @@ -1273,10 +1273,10 @@ Instance methods:
hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond, \
tzinfo=self.tzinfo, *, fold=0)

Return a datetime with the same attributes, except for those attributes given
new values by whichever keyword arguments are specified. Note that
``tzinfo=None`` can be specified to create a naive datetime from an aware
datetime with no conversion of date and time data.
Return a new datetime with the same attributes, except with new attributes
for those parameters given by whichever keyword arguments are specified.
Note that ``tzinfo=None`` can be specified to create a naive datetime from
an aware datetime with no conversion of date and time data.

:class:`.datetime` objects are also supported by generic function
:func:`copy.replace`.
Expand Down Expand Up @@ -1851,10 +1851,10 @@ Instance methods:
.. method:: time.replace(hour=self.hour, minute=self.minute, second=self.second, \
microsecond=self.microsecond, tzinfo=self.tzinfo, *, fold=0)

Return a :class:`.time` with the same value, except for those attributes given
new values by whichever keyword arguments are specified. Note that
``tzinfo=None`` can be specified to create a naive :class:`.time` from an
aware :class:`.time`, without conversion of the time data.
Return a new :class:`.time` with the same values, except with new values for
those attributes given by whichever keyword arguments are specified. Note
that ``tzinfo=None`` can be specified to create a naive :class:`.time` from
an aware :class:`.time`, without conversion of the time data.

:class:`.time` objects are also supported by generic function
:func:`copy.replace`.
Expand Down
0