� This function takes a name string that must be a string specifying a
� valid zoneinfo timezone, ie "US/Eastern", "Europe/Warsaw" or "Etc/GMT+11".


It isn't 100% clear to me from the PEP what a valid name string would be,
but I assume that it will accept anything that the time.tzset function
will accept:

No, valid names are the names of time zones in the zoneinfo database. There isn't really any usecase for defining up your own rules as that would mean that you want a time zone that doesn't exist, which seems a bit pointless. :-)
">

(original) (raw)

On Sat, Dec 29, 2012 at 2:23 AM, Steven D'Aprano <steve@pearwood.info> wrote:

The PEP says:



* New function :``timezone(name=None, db_path=None)``





� This function takes a name string that must be a string specifying a

� valid zoneinfo timezone, ie "US/Eastern", "Europe/Warsaw" or "Etc/GMT+11".





It isn't 100% clear to me from the PEP what a valid name string would be,

but I assume that it will accept anything that the time.tzset function

will accept:

No, valid names are the names of time zones in the zoneinfo database. There isn't really any usecase for defining up your own rules as that would mean that you want a time zone that doesn't exist, which seems a bit pointless. :-)



(We have KeyError rather than UnknownKeyError, NameError rather than

UnknownNameError, etc.)

Sure, but what would otherwise a KeyError be unless an unkown or non-existing key?

//Lennart