Skip to content

[3.13] gh-115684: Clarify datetime replace documentation (GH-116519) #131676

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 1 commit into from
Apr 8, 2025

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Mar 24, 2025

  • 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 d2d8862)

Co-authored-by: David Lowry-Duda [email protected]
Co-authored-by: Paul Ganssle [email protected]


📚 Documentation preview 📚: https://cpython-previews--131676.org.readthedocs.build/

…16519)

* Clarify datetime `replace` documentation

In pythonGH-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 pythonGH-115684.

* Include reviewer comments

Thanks Privat33r-dev for the comments!

---------
(cherry picked from commit d2d8862)

Co-authored-by: David Lowry-Duda <[email protected]>
Co-authored-by: Paul Ganssle <[email protected]>
@bedevere-app bedevere-app bot added the docs Documentation in the Doc dir label Mar 24, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Mar 24, 2025
@Yhg1s Yhg1s merged commit 7e9c577 into python:3.13 Apr 8, 2025
28 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants