Why are there no ordered dictionaries?

bonono at gmail.com bonono at gmail.com
Sun Nov 20 20:42:13 EST 2005


Christoph Zwerschke wrote:
> bonono at gmail.com wrote:
> > Personally, I have needs for ordered dict but I don't think it should
> > be in standard library though, as different situation called for
> > different behaviour for "ordered" and skewing my code to a standard lib
> > way is no good.
>
> I have started the thread in the first place because I believed it is
> pretty unabmiguous what an "ordered dictionary" is and how it should
> behave. That's why I asked myself why something that straigthforward has
> not been added to the standard lib yet. Maybe I'm wrong; I must admit
> that I haven't meditated about it very much.
>
> Do you have an example for different options of behavior?
>
As mentioned, most ordered dict I saw is "insertion order" based. I
assume that is the need of their creators. But that is not my need, so
there are at least two behaviour. What I need is a "preferred order".
Say if I have designed a web form(correspond to a database table), I
just want say 3 fields that goes before anything else in the
presentation. The rest I don't care as the DBA may create more fields
later which I don't want to then update my code yet again.




More information about the Python-list mailing list