Here's a happy idea: punt.
I'd be happy to punt on the multiple DST switch points for astimezone().
We could define a new tzinfo method to be implemented by the user:
def fromutc(self, dt): """Convert UTC time to local time.
dt is a plain datetime or a naive datetimetz whose date and time members represent a UTC time. Return a datetimetz y, with y.tzinfo == self, representing the equivalent in tz's local time. """
Then I can raise an exception for unspellable hours in my Eastern class, and you can make them return your birthday in your Eastern class, and the two surviving members of the United Kindgom Memorial Double Daylight Society can eat watercress sandwiches at the local pub in peace <wink>.
astimezone becomes:
def astimezone(self, dt): return dt.fromutc((self - self.utcoffset()).replace(tzinfo=None))
But now even the simplest tzinfo implementations (those with a fixed offset) have to implement something a bit tricky: ZERO = timedelta() class fixed(tzinfo): def __init__(self, offset): self.offset = timedelta(minutes=offset) def utcoffset(self, dt): return self.offset def dst(self, dt): return ZERO def fromutc(self, dt): return datetimetz.combine(dt.date(), dt.time(), tzinfo=self) + self.offset I find that last line cumbersome. For variable-dst zones it goes way up: the DST transition boundaries have to be translated to UTC in order to be able to make sense out of them in fromutc(), but they're still needed in local time for dst(). But I agree that we could probably improve life for all involved if we changed the tzinfo implementation. Perhaps we should constrain DST-aware timezones to the most common model, where there are two offsets (standard and DST) and two transition datetime points in local standard time (DST on and DST off). A tzinfo would have methods that would let you inquire these things directly; the offsets would be simple attributes, and the DST on and off points would be returned by a method that only takes the year as input (astimezone() would have to be careful to expect DST on to be > DST off for the southern hemisphere). I suppose the Israeli implementation would have to use a table of transition points for past years and always return standard time for future years (since the Knesseth decides on the switch points each year). The implementation for British time during WWII would have to tell a little lie -- big deal. --Guido van Rossum (home page: http://www.python.org/~guido/)