Odds and Ends
The ISO standard 8601 describes date formatting that goes year-month-day, etc. The
datetime module’s parsing function has been adapted to be able to parse more of the specification. It now handles week numbers and the UTC time indicator.
Let’s go look at some examples. This script contains a list of strings which follow the ISO spec. Previously, Python only supported a subset of the spec and some of the values, although compliant, would not be parsed. Notice the use of
That isn’t a typo. That indicates week 40 of the year instead of the month. Likewise with the trailing
Zs that indicate UTC, also known as the Zulu time zone. At the bottom of the script, I enumerate through each of these strings and either print the conversion or an error.
02:46 A cleanup effort is underway to remove old libraries. There are hundreds of modules in the standard library, and all of them need to be maintained. Some of them have newer modules that replace their functionality, and some of them just aren’t used anymore, like Telnet.
03:04 PEP 594 proposed the removal of a bunch of dead batteries. They’ve been marked as deprecated and are scheduled for full removal in Python 3.13. The last lesson is next. I’ll summarize the course, speak briefly about whether you should upgrade, and point you at some sources of further investigation.
Become a Member to join the conversation.