I've written up some thoughts on this here: https://github.com/python/cpython/issues/66571#issuecomment-1107838638

TL;DR: There's probably something more we can do before we close out #66571, but I doubt there will ever be a great way to make this work the way people think it intuitively should (mostly because people intuitively think that the 3-letter abbreviations 1. exist for all zones and 2. are globally unique).

Generally speaking, the kind of thing output by %Z is an attractive nuisance and probably shouldn't ever be used — though I'm sure it will continue to be used for decades to come anyway.


On 4/24/22 01:04, Eugene Triguba wrote:
On Saturday, April 23, 2022, Chris Angelico <rosuav@gmail.com> wrote:
For any timezone at all? That'd be ambiguous for BST, CST, and a bunch
of others. Timezone abbreviations aren't unique.

For a select set? Maybe, but then there'd need to be a way to choose
which ones you want to recognize, which might still end up being too
small and/or too large.

Thanks Chris. I hadn’t recognized that detail of them not being unique.

Would this issue be good to close out in that case? It seems the work of clarifying the docs had been done: https://github.com/python/cpython/issues/66571

And I would imagine the scope of this issue (https://github.com/python/cpython/issues/72751) then would only be for making utc, gmt, and the local time zone that is parsed from %Z to be tz-aware date times instead of the current naive date times?

Would it be worthwhile to look into if we can improve some of these strptime error messages? For instance, currently when parsing with %Z, the function gives a ValueError saying our string doesn’t match the given format if we try to parse a timezone that isn’t utc, gmt, or our local timezone but I would expect knowing that it is completely invalid or valid but not the local timezone/utc/gmt would be more useful?

I know there has been some conversations and work regarding improving the error message for the day/month: https://github.com/python/cpython/issues/69117

Datetime-SIG mailing list -- datetime-sig@python.org
To unsubscribe send an email to datetime-sig-leave@python.org
The PSF Code of Conduct applies to this mailing list: https://www.python.org/psf/codeofconduct/