3 ms·
not sure, I tried this in Python 3.11.6 and `datetime.UTC` works whereas `datetime.timezone.utc` doesn't exist in any case, just compare datetime.datetime
by tomp 3y ago
not sure, I tried this in Python 3.11.6 and `datetime.UTC` works whereas `datetime.timezone.utc` doesn't exist
in any case, just compare
datetime.datetime.utcnow()
and
datetime.datetime.now(datetime.UTC).replace(tzinfo=None)
verbosity is not a virtue in this case
- remram 3y agoThis is verbose because it is dissuaded. The whole point of this change is to not have users get naive datetime objects, of course it gets more verbose.
- int_19h 3y ago`datetime.timezone.utc` is the original way of doing it and should work just fine on a stock Python 3.11 install. `datetime.UTC` is a relatively recent addition, and if you look at the actual type of the object it returns, it's still `datetime.timezone.utc`
- forgotpwd16 3y agoSo my installation was outdated. Still not fan of having two different ways to refer to the same thing.