Why did nobody tell me that in #Python 3.11, datetime.fromisoformat() can parse arbitrary ISO timestamps!? #gameChanger

(Before it could only parse the output from datetime.isoformat(); e.g. choking on timestamps ending with a Z for UTC.)

@hynek someone made me review this because of my ranting about ISO 8601.

It's not bad. It's not complete: but no one actually wants a complete parser for that awful trash standard.

@hynek Well, many thanks for telling me! 😀 This have irritated me so many times!
@hynek @rixx ooh this is cool!! If that’s true I can delete at least a hundred lines of code 😍
@hynek Is there a chance to have this available in older releases (3.7+) somehow? Parsing ISO timestamps an issue I encounter in so many projects. Of course the issue is not only lexical variations but also subtleties like ECMAscript behavior for 24:00 and such nasties …
parser — dateutil 2.8.2 documentation

@hynek That’s what I do currently, too. I was just wondering if there is an *identically behaving* implementation available as an independent module (like it was for e.g. argparse), so I would have just one if around the import and will not run into runtime differences … Because otherwise I will continue to use dateutil on all versions, including 3.11+ until 3.11 is the oldest supported version around.

@hynek

@rixx

Sorry, my Nana wasn't well, and the dog ate my homework... I just forgot.

@hynek Where exactly can I find "fromisotimestamp()"? I tried homebrew py3.11.0 and it is neither in "datetime" nor in "datetime.datetime". I also can't find it in the docs.
datetime — Basic date and time types

Source code: Lib/datetime.py The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is on efficient attr...

Python documentation
@sscherfke I love how everyone autocorrected it in their heads except you :D
@hynek I am like a computer. I take literally what you give me. 🤪🤖
@hynek @sscherfke Good grief, I didn't even notice 🤣