[Python-Dev] PEP 431 Time zone support improvements - Update

Brett Cannon brett at python.org
Tue Jan 8 20:02:50 CET 2013


On Tue, Jan 8, 2013 at 1:08 PM, Lennart Regebro <regebro at gmail.com> wrote:
> On Fri, Dec 28, 2012 at 10:12 PM, Ronald Oussoren <ronaldoussoren at mac.com>
> wrote:
>>
>>
>> On 28 Dec, 2012, at 21:23, Lennart Regebro <regebro at gmail.com> wrote:
>>
>> > Happy Holidays! Here is the update of PEP 431 with the changes that
>> > emerged after the earlier discussion.
>>
>> Why is the new timezone support added in a submodule of datetime? Adding
>> the new
>> function and exception to datetime itself wouldn't clutter the API that
>> much, and datetime
>> already contains some timezone support (datetime.tzinfo).
>
>
> Putting the API directly into the datetime module does conflict with the new
> timezone class from Python 3.2. The timezone() function therefore needs to
> be called something else, or the timezone class must be renamed.

Can't rename the class since that would potentially break code (e.g.
if the class can be pickled).

>
> Alternative names for the timezone() function is get_timezone(), which has
> already been rejected, and zoneinfo() which makes it clear that it's only
> zoneinfo timezones that are relevant.

I'm personally +0 on zoneinfo(), but I don't have a better suggestion.

-Brett


> Or the timezone class get's renamed TimeZone (which is more PEP8 anyway).
>
> We can allow the timezone() function to take both timezone(offset, [name])
> as now, and timezone(name) and return a TimeZone object in the first case
> and a zoneinfo based timezone in the second case.
>
> Or maybe somebody else can come up with more clever options?
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>


More information about the Python-Dev mailing list