Performance ordered dictionary vs normal dictionary

Chris Rebert clp2 at rebertia.com
Thu Jul 29 02:05:29 EDT 2010


On Wed, Jul 28, 2010 at 9:06 PM, sturlamolden <sturlamolden at yahoo.no> wrote:
> On 29 Jul, 03:47, Navkirat Singh <navkir... at gmail.com> wrote:
>> I was wondering what would be better to do some medium to heavy book keeping in memory - Ordered Dictionary or a plain simple Dictionary object??
>
> It depends on the problem. A dictionary is a hash table. An ordered
> dictionary is a binary search tree (BST).

Er, if you're talking about collections.OrderedDict specifically,
you're wrong. It's quite clearly implemented using a regular
dictionary (i.e. hash table) and auxiliary list: See
http://bugs.python.org/file13231/od7.diff from
http://bugs.python.org/issue5397

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list