[Python-Dev] datetime.fromisocalendar (original) (raw)
Guido van Rossum guido at python.org
Sat Apr 27 16:33:45 EDT 2019
- Previous message (by thread): [Python-Dev] datetime.fromisocalendar
- Next message (by thread): [Python-Dev] datetime.fromisocalendar
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I think it’s a good idea.
On Sat, Apr 27, 2019 at 11:43 AM Paul Ganssle <paul at ganssle.io> wrote:
Greetings, > Some time ago, I proposed adding a
.fromisocalendar
alternate constructor todatetime
(bpo-36004 <https://bugs.python.org/issue36004>), with a corresponding implementation (PR #11888 <https://github.com/python/cpython/pull/11888>). I advertised it on datetime-SIG some time ago but haven't seen much discussion there, so I'd like to bring it to python-dev's attention as we near the cut-off for new Python 3.8 features. > Other than the fact that I've needed this functionality in the past, I also think a good general principle for the datetime module is that when a class (time, date, datetime) has a "serialization" method (.strftime, .timestamp, .isoformat, .isocalendar, etc), there should be a corresponding deserialization method (.strptime, .fromtimestamp, .fromisoformat) that constructs a datetime from the output. Now thatfromisoformat
was introduced in Python 3.7, I thinkisocalendar
is the only remaining method without an inverse. Do people agree with this principle? Should we add thefromisocalendar
method? > Thanks, Paul _________________________ Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org--Guido (mobile) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20190427/3beff194/attachment.html>
- Previous message (by thread): [Python-Dev] datetime.fromisocalendar
- Next message (by thread): [Python-Dev] datetime.fromisocalendar
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]