[Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement

rdmurray at bitdance.com rdmurray at bitdance.com
Wed Mar 4 13:53:36 CET 2009


On Wed, 4 Mar 2009 at 23:37, Lie Ryan wrote:
> Steve Holden wrote:
>>  Raymond Hettinger wrote:
>> > > >  Perhaps the terminology should be
>> > > > 
>> > > >    ordereddict -- what we have here
>> > > > 
>> > > >    sorteddict -- hypothetical future type that keeps
>> > > >                  itself sorted in key order
>> >  +1
>> > 
>> > 
>> > >  FIFOdict ?  Yeah, that blows the capitalization scheme, way, way out.
>> >  Issues:
>> >  * The popitem() method is LIFO.
>> >  * In a non-popping context, there is no OUT.  It just stores.
>> >  * FIFO is more suggestive of queue behavior which does not apply here.
>> >  * Stores to existing keys don't go at the end; they leave the order
>> >  unchanged.
>> > 
>> >  FWIW, PEP 372 has links to seven other independent implementations and
>> >  they all have names that are some variant spelling OrderedDict except
>> >  for one which goes by the mysterious name of StableDict.
>> > 
>> >  Am still +1 on painting the class green with pink polka dots, but I'm
>> >  starting to appreciate why others are insisting on pink with green polka
>> >  dots ;-)
>> >
>>  historydict?
>
> agedict?

I actually like StableDict best.  When I hear that I think, "ah, the
key order is stable in the face of insertions, unlike a regular dict".
Nor can I at the moment think of an alternative explanation of what a
"StableDict" might be.

That said, I have no problem with keeping OrderedDict as the name.
("Ordered does not mean sorted, it means insertion order preserving"
may become a FQA (Frequent Question Answer :), but it is short and
clear and takes no longer than explaining what a StableDict _is_.)

Although, that might be another argument in favor of StableDict: since
unless you think what I wrote above you aren't going to have a clue what
it is, someone reading code and encountering it would be more likely to
look it up, whereas with OrderedDict someone is more likely to assume they
know what it is and get confused for a little while before looking it up.

Do I feel strongly enough about this to write a patch?  No :)

--RDM


More information about the Python-Dev mailing list