-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Feature
I would like to be able to have a way to say foo: datetime but know that foo either:
- definitely doesn't have a tzinfo
- has a tzinfo
- has a tzinfo that specifically is / isn't from pytz
This could be resolved by an Intersection[] type as described in #2087 and a protocol that defines the tzinfo attribute appropriately.
Pitch
My database layer can only persist datetimes with a timezone; my timezone parsing code has portions where I want to make sure I haven't associated a timezone yet because to do so and then convert while replacing it would be an error. Really, naive datetimes and aware datetimes are subtly, but profoundly different types of objects, and their arithmetic represents different types of deltas.
Also, pytz requires different sorts of logic on arithmetic and comparison (i.e. possibly normalize is required) than other zoneinfo objects.