sorteddict PEP proposal [started off as orderedict]
Steve Holden
steve at holdenweb.com
Wed Sep 26 11:17:33 EDT 2007
Mark Summerfield wrote:
> On 26 Sep, 13:22, Antoon Pardon <apar... at forel.vub.ac.be> wrote:
[...]
>> So it seems the API needs some more sorting out.
>
> I think you missed some of the previous postings.
>
> The sorteddict API that has emerged so far is (1) apart from the
> constructor, everything is identical to dict, (2) the constructor
> takes the same args as sorted(), so if you want to seed with a dict or
> with keywords you write sorteddict(dict(a=1,b=2), ...), (or you could
> create a sorteddict and use update() since that takes the same args as
> dict's constructor).
>
> Could your AVLTree support cmp and keys and reverse?
>
I don't see how you can guarantee ordering of the seeded components,
since you are creating an inherently unpredictable dict as the component
to specify the initial contents of the sorteddict.
Or is an arbitrary initial ordering acceptable?
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Sorry, the dog ate my .sigline
More information about the Python-list
mailing list