Repository navigation
Conversation
…a tzinfo Add a section on wall time and absolute time semantics, with an example of doing the arithmetic in UTC, and link to it from the datetime operation notes and from zoneinfo. In the subtraction and comparison notes, say that fold is ignored when both operands share the same tzinfo object, and that skipped times are never equal to times in another time zone.
Member
|
What is the difference between #137092 and this PR? why do we have two PRs for the same issue? |
Member
|
While the other PR is stale, it's common courtesy to first ask if the OP wants to continue the work and wait for some time (say 2 weeks) before opening a PR. Maintainers also tend to work directly on stale PRs if necessary rather so that original contribution credits are retained. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Arithmetic and comparisons on aware datetimes sharing a
tzinfoignore the UTC offset (wall time), by design (PEP 495), so results across a DST transition don't match elapsed time. This is only mentioned in the operation notes, andzoneinfo.rstsays transitions are handled "with no further intervention", which suggests the opposite. This keeps coming up as bug reports (#116111, #112638, #146236, …).This PR:
datetime.rst, with an example of doing the arithmetic in UTC;timedeltaaddition (1), subtraction (3), equality (4) and order comparison (5), and fromzoneinfo.rst, replacing that sentence;foldin the subtraction note (3), and skipped times in the equality note (4), as PEP 495 specifies.Same zone versus same
tzinfoobject (is) is left for a follow-up.Thanks to @NehaJeevan for #137092, which first proposed fixing the
zoneinfo.rstsentence.See also #146236, #123487.
Docs only, so I think this can be
skip news.I used an LLM to review my work. But the research and the changes are mine, and I'm happy to explain any of it.