-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Conversation
In python#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 python#115684.
Thank you for your contribution, generally looks good and fixes the issue. |
Thanks Privat33r-dev for the comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks! You're very quick on the reply, too. |
@pganssle do you want to review? :) If not, maybe we can ping other Core members responsible for documentation? |
I do not see any clarifications, just rewording. What do you think @pganssle ? |
Thanks @davidlowryduda for the PR, and @pganssle for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…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]>
GH-131676 is a backport of this pull request to the 3.13 branch. |
Sorry, @davidlowryduda and @pganssle, I could not cleanly backport this to
|
GH-131683 is a backport of this pull request to the 3.12 branch. |
…honGH-116519) * 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]>
GH-131694 is a backport of this pull request to the 3.12 branch. |
) * Clarify datetime `replace` documentation In python#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 python#115684. * Include reviewer comments Thanks Privat33r-dev for the comments! --------- Co-authored-by: Paul Ganssle <[email protected]>
#131694) * 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: Paul Ganssle <[email protected]>
#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 d2d8862) Co-authored-by: David Lowry-Duda <[email protected]> Co-authored-by: Paul Ganssle <[email protected]>
) * Clarify datetime `replace` documentation In python#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 python#115684. * Include reviewer comments Thanks Privat33r-dev for the comments! --------- Co-authored-by: Paul Ganssle <[email protected]>
In #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 indatetime
return new objects. This uses similar wording to the documentation fordatetime.combine()
, which specifies that a new datetime is returned. This is also similar to wording forstring.replace()
, exceptstring.replace()
emphasizes that a "copy" is returned.Resolves #115684.
📚 Documentation preview 📚: https://cpython-previews--116519.org.readthedocs.build/