Proposal: date.fromisocalendar
Some time ago, I posted a bpo-36004 <https://bugs.python.org/issue36004>, proposing the addition of a `date.fromisocalendar` alternate constructor, and the corresponding PR #11888 <https://github.com/python/cpython/pull/11888> implementing it. This function is the inverse of `date.isocalendar`. I think that, whenever possible, if we have a function that serializes a date or datetime, we should have a conjugate function that constructs a date/datetime from the output; the big one of these was `datetime.fromisoformat`, which was added in Python 3.7, but I have noticed that `isocalendar` also does not currently have an inverting function, and I'd like to add that for Python 3.8. It has been finished for a while, but I would like some additional review of both the idea and implementation, so I'd like to bring it to the attention of the list. Best, Paul
Hi Paul, I just wanted to say that I like the idea ;-) I like your rationale for the new method. I didn't review the implementation yet. Don't hesistate to ping me if you want my review! Victor Le mer. 3 avr. 2019 à 20:50, Paul Ganssle <paul@ganssle.io> a écrit :
Some time ago, I posted a bpo-36004, proposing the addition of a `date.fromisocalendar` alternate constructor, and the corresponding PR #11888 implementing it.
This function is the inverse of `date.isocalendar`. I think that, whenever possible, if we have a function that serializes a date or datetime, we should have a conjugate function that constructs a date/datetime from the output; the big one of these was `datetime.fromisoformat`, which was added in Python 3.7, but I have noticed that `isocalendar` also does not currently have an inverting function, and I'd like to add that for Python 3.8.
It has been finished for a while, but I would like some additional review of both the idea and implementation, so I'd like to bring it to the attention of the list.
Best, Paul _______________________________________________ Datetime-SIG mailing list -- datetime-sig@python.org To unsubscribe send an email to datetime-sig-leave@python.org https://mail.python.org/mailman3/lists/datetime-sig.python.org/ The PSF Code of Conduct applies to this mailing list: https://www.python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.
participants (2)
-
Paul Ganssle
-
Victor Stinner