-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Add datetime.fromisocalendar #80185
Comments
Datetime has many methods that "serializes" an instance to some other format - toordinal, timestamp, isoformat, etc. Most methods that "serialize" a datetime have a corresponding method that "deserializes" that method, or another way to reverse the operation:
However, as I found out when implementing I have an implementation as part of dateutil.parser.isoparse: https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py#L297 If there are no objections, I'd like to add an implementation in CPython itself. Thinking the name should be |
+1 |
1 similar comment
+1 |
I have a first-pass PR, a few questions to address:
I think for questions 3 and 4 the answer is no, modelling after .toordinal/.fromordinal. |
The attached PR is more or less fully ready, I think the correct answers to 1, 3 and 4 are that we should go with 3 separate arguments and we should not allow either time components or tz components, at least in this version. In the future, I don't think it will be backwards incompatible to add in these features if they are desired (though I imagine they won't be terribly in demand, and it's pretty easy to work around). The only real remaining question is number 2. Right now I am allowing keyword arguments, but the only real value I see in doing that is that PEP-570 (positional-only parameters) is not done yet and it's kind of annoying to implement "positional only parameters" in the pure Python version. If anyone feels strongly about this, let me know, otherwise I'll switch the implementation over to positional-only parameters. |
Thanks Paul, nice enhancement! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: