[Python-Dev] PEP 431 Updates

Nick Coghlan ncoghlan at gmail.com
Mon Jan 28 13:31:29 CET 2013


On Mon, Jan 28, 2013 at 10:06 PM, Lennart Regebro <regebro at gmail.com> wrote:
> On Sat, Jan 26, 2013 at 10:38 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> 2. Under "New class DstTzInfo"
>>
>> This will be a subclass of "tzinfo" rather than "zoneinfo" (which is
>> not a class). Given that this is a *concrete* subclass, you may want
>> to consider the name "DstTimezone", which would be slightly more
>> consistent with the existing "timezone" fixed offset subclass.
>> (Incidentally, *grumble* at all the existing classes in that module
>> without capitalized names...)
>
> Which probably mean it actually rather should be called tztimezone or something.

"dsttimezone", "dst_timezone", "timezonedst" or "timezone_dst" are
probably the possibilities most consistent with the current naming
scheme. Of those "dst_timezone" is probably the best of a fairly bad
bunch.

>> 6. Under "New collections"
>>
>> Why both lists and sets?
>
> Because pytz did it. But yes, you are right, an ordered set is a
> better solution. Baseing it on OrderedDict seems like a hack, though.
> I could implement a custom orderedset, of course.

Sets themselves have an honourable history of just being a thin
wrapper around dictionaries with all the values set to None (although
they're not implemented that way any more). Whether you create an
actual OrderedSet class, or just expose the result of calling keys()
on an OrderedDict instance is just an implementation detail, though.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list