]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-115684: Clarify datetime `replace` documentation (GH-116519) (#131676)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 8 Apr 2025 08:45:21 +0000 (10:45 +0200)
committerGitHub <noreply@github.com>
Tue, 8 Apr 2025 08:45:21 +0000 (10:45 +0200)
commit7e9c5772a88f9d39632d173de5fdbb223ca7923b
treeaa83ecbfca8574076c87c26b322c8483fd039c51
parent53b9370c43bd7637f677ac069c203cd42bf8c2ce
[3.13] gh-115684: Clarify datetime `replace` documentation (GH-116519) (#131676)

gh-115684: Clarify datetime `replace` documentation (GH-116519)

* Clarify datetime `replace` documentation

In GH-115684, HopedForLuck noted that `datetime.date.replace()`
documentation was confusing because it looked like it would be changing
immutable objects.

This documentation change specifies that the `replace()` methods in
`datetime` return new objects. This uses similar wording to the
documentation for `datetime.combine()`, which specifies that a new
datetime is returned. This is also similar to wording for
`string.replace()`, except `string.replace()` emphasizes that a "copy"
is returned.

Resolves GH-115684.

* Include reviewer comments

Thanks Privat33r-dev for the comments!

---------
(cherry picked from commit d2d886215cf694d5f3e7f0cbd76507a96bac322b)

Co-authored-by: David Lowry-Duda <david@lowryduda.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
Doc/library/datetime.rst