Are dictionaries the same as hashtables?

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Aug 26 11:46:49 CEST 2008


cnb <circularfunc at yahoo.se> writes:

> Are dictionaries the same as hashtables?

The 'dict' type in Python has certain behaviour, as specified in the
language reference. In CPython they are implemented as hash tables,
but I don't recall anything that specifies they *must* be implemented
that way.

So my answer would be "maybe, but don't count on it". Write your
program to the specified behaviour of the language, not to the
underlying implementation.

-- 
 \        “With Lisp or Forth, a master programmer has unlimited power |
  `\     and expressiveness. With Python, even a regular guy can reach |
_o__)                               for the stars.” —Raymond Hettinger |
Ben Finney



More information about the Python-list mailing list