| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This is churn in my opinion, and quite a lot of it. I agree with Paul Moore's comment, we need not enforce such things. I also don't see consensus in the thread for this, from a rough count I gather more people are against the change.
Sorry, something went wrong.
There's no enforcement here, this is a docs-only change. You can still import datetime if you prefer. There are no stdlib (or linter) changes.
I disagree. I see more people against code and linter changes, but maybe just a couple against docs changes. I see 12 supporting Terry's docs suggestion (plus him), and another couple also supporting via comments. |
Sorry, something went wrong.
|
I'm in favor of changing these examples in the docs. It provides a clear distinction between the module and the class, while gently showing importing the module as a preference over importing the classes directly. |
Sorry, something went wrong.
|
I do struggle with new Python learners hitting confusion about the different between the module and the class datetime, especially in example code like datetime.now(). I tend to use the from datetime import ... convention in my own code, but that's the convention that's most likely to cause datetime confusion for new learners. I am in favor of changing the documentation so that they do not use the from datetime import ... syntax. I think this import datetime as dt convention is a good way to do that. I read through all the changes and they look good to me. 👍 |
Sorry, something went wrong.
|
I'm also in favor of this change. Too many times my IDE bite me by importing the class instead of the module or vice-versa so import datetime as dt would definitely help newcomers to distinguish between the module, the class, and the instace method datetime.datetime.time! |
Sorry, something went wrong.
There was a problem hiding this comment.
If the docs experts think it's best, I won't block.
Sorry, something went wrong.
|
Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry, something went wrong.
(cherry picked from commit d3b6faf) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
Sorry, @hugovk, I could not cleanly backport this to 3.13 due to a conflict. cherry_picker d3b6faf9758dce236d45c708a450437cdc3e97cd 3.13 |
Sorry, something went wrong.
|
GH-145583 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
(cherry picked from commit d3b6faf) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
GH-145584 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Please see PR #145640. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
See https://discuss.python.org/t/renaming-datetime-datetime-to-datetime-datetime/26279/4 and the following post for support.
There's a few other examples in other files we can update after this.
📚 Documentation preview 📚: https://cpython-previews--145315.org.readthedocs.build/en/145315/library/datetime.html