-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-27741: Better wording for datetime.strptime() #9994
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
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.
I don't think this is wrong, though I would probably use "timezone offset" instead of "timezone", since nothing in One suggestion of a possible alternate wording (and I'm not really convinced that it's much better), is to retain the "equivalent" language but specify that it's for a special case:
I sorta like being explicit about what things are intended to be equivalent, since similar is a more ambiguous term, but obviously this makes phrase wordier. |
@pganssle I don't think the extra words in your suggestion would be a problem. My only concern is that we are describing something as equivalent, and pointing an exception just after. |
@augustogoulart I think "X is equivalent to Y under condition Z" is valid, my wording was that the two expressions are equivalent except when ..., to be precise as to when the two do the same thing and when they don't. |
Thanks, @pganssle! |
I agree with @pganssle's suggestion here. Minor suggestion: "but not |
@augustogoulart: Can you please make the change suggested by @taleinat? @pganssle: I would prefer to wait for your ACK on this PR before merging it. Would you mind to Approve it once it looks good to you? |
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.
IMO the last part of the sentence is unnecessary.
Doc/library/datetime.rst
Outdated
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``. | ||
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``, except | ||
when the format includes sub-second components or timezone offset information, | ||
which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``, |
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.
which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``, | |
which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``. |
Doc/library/datetime.rst
Outdated
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``, except | ||
when the format includes sub-second components or timezone offset information, | ||
which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``, | ||
since ``time.strptime`` won't fail; however, it will silently ignore such input. |
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.
since ``time.strptime`` won't fail; however, it will silently ignore such input. |
I have made the requested changes; please review again. |
Is there anyone interested by this other strptime() doc issue? https://bugs.python.org/issue19376 |
Thanks @augustogoulart for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6. |
Thanks @augustogoulart for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-10213 is a backport of this pull request to the 3.6 branch. |
Thanks @augustogoulart for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7. |
GH-10214 is a backport of this pull request to the 3.7 branch. |
(cherry picked from commit c0799ec) Co-authored-by: Gus Goulart <augusto@goulart.me>
(cherry picked from commit c0799ec) Co-authored-by: Gus Goulart <augusto@goulart.me>
GH-10215 is a backport of this pull request to the 2.7 branch. |
(cherry picked from commit c0799ec) Co-authored-by: Gus Goulart <augusto@goulart.me>
I've marked that as "easy"; expect a PR rather quickly! |
Datetime is not easy, but we will see :-) See how many iterations were needed just for this simple doc change ;-) |
https://bugs.python.org/issue27741