Skip to content

datetime.rst: correct timedelta description#101417

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
belm0:patch-3
Feb 2, 2024
Merged

datetime.rst: correct timedelta description#101417
serhiy-storchaka merged 2 commits into
python:mainfrom
belm0:patch-3

Conversation

@belm0

@belm0 belm0 commented Jan 30, 2023

Copy link
Copy Markdown
Contributor

It was confusingly claimed that timedelta could represent the difference between two datetime.time objects.

Subtraction of two datetime.time values is not allowed, nor can a timedelta be added to a time.

@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Jan 30, 2023
Comment thread Doc/library/datetime.rst Outdated
@belm0

belm0 commented Feb 2, 2023

Copy link
Copy Markdown
Contributor Author

@abalkin I think it's another straightforward datetime correction-- would you take a look?

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thank you for your contribution @belm0.

@serhiy-storchaka serhiy-storchaka added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Feb 2, 2024
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) February 2, 2024 21:17
belm0 added 2 commits February 3, 2024 06:20
It was confusingly claimed that `timedelta` could represent the difference between two `datetime.time` objects.

Subtraction of two `datetime.time` values is not allowed, nor can a `timedelta` be added to a `time`.  And specifically, this conflicted text in the "timedelta Objects" section, stating "A timedelta object represents [...] the difference between two dates or times."
  * list `datetime` ahead of `date`, since it's more common when
    using `timedelta`
auto-merge was automatically disabled February 2, 2024 21:20

Head branch was pushed to by a user without write access

@belm0

belm0 commented Feb 2, 2024

Copy link
Copy Markdown
Contributor Author

I rebased-- please re-apply auto-merge and tag skip issue. Thank you @serhiy-storchaka

@serhiy-storchaka serhiy-storchaka merged commit 73d20ca into python:main Feb 2, 2024
@miss-islington-app

Copy link
Copy Markdown

Thanks @belm0 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <john@neggie.net>
@bedevere-app

bedevere-app Bot commented Feb 2, 2024

Copy link
Copy Markdown

GH-114938 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Feb 2, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <john@neggie.net>
@bedevere-app

bedevere-app Bot commented Feb 2, 2024

Copy link
Copy Markdown

GH-114939 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.11 only security fixes label Feb 2, 2024
serhiy-storchaka pushed a commit that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <john@neggie.net>
serhiy-storchaka pushed a commit that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <john@neggie.net>
@belm0 belm0 deleted the patch-3 branch February 2, 2024 22:10
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
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 issue skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants