-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-93267: Fix wrong result Documented in Date Arithmetic datetime #93506
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
I don't believe swapping the order fixes anything, as "removed" is commutative (at least in British English) -- e.g. your first cousin once removed could be your father's cousin or your son's cousin. We could update to "away from" as per the issue, although personally I feel that looses a little clarity of expression. Regardless, you should update line 1148 ("tetime2 is a duration of timedelta removed from datetime1, moving forward in") to the same verbiage that we decide on. cc: @ericvsmith A |
Doc/library/datetime.rst
Outdated
@@ -589,8 +589,8 @@ Supported operations: | |||
+-------------------------------+----------------------------------------------+ | |||
| Operation | Result | | |||
+===============================+==============================================+ | |||
| ``date2 = date1 + timedelta`` | *date2* is ``timedelta.days`` days removed | | |||
| | from *date1*. (1) | | |||
| ``date2 = date1 + timedelta`` | *date1* is ``timedelta.days`` days removed | |
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.
The result should be what will be the value of date2
because date2
is what being assigned to. Suggestion:
Results in `timedelta.days` added to `date1`.
Even though it seems a bit repetitive to restate the operation on the left, it's already very intuitive and it would confirm to the reader that the +
operator here does the obvious thing and not something weird.
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.
How about *date2* will be ``timedelta.days`` after *date1*.
I think "after" indicates the direction correctly.
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.
That sounds good to me, using "after" here makes sense.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
@180909: Do you want to finish this PR, or should we close it? |
I think we can leave this issue open in case someone else wants to pick it up. It's just the PR that has apparently been abandoned. This seems like a good first issue for someone. I'll mention it on core-mentorship. |
Oops, this is the PR. I'm constantly getting PRs and issues confused. Reclosing. |
#93267