If python dictionaries are inherently orderless, why were they given the name if a real dictionary is sorted by letter?
4th February 2012
My answer to If python dictionaries are inherently orderless, why were they given the name if a real dictionary is sorted by letter? on Quora
The metaphor here is that paper dictionaries make it easy to look stuff up by letter or word—just like Python dictionaries make looking something up by key an instant operation.
I don’t know of any other languages that use the word “dictionary” for this—Perl and Ruby call them Hashes, PHP calls them Associative Arrays, JavaScript calls them Objects, Lua calls them Tables. Personally I find the term dictionary more intuitive than those alternatives but I do spend way more of my time with Python.
More recent articles
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024
- Visualizing local election results with Datasette, Observable and MapLibre GL - 9th November 2024
- Project: VERDAD - tracking misinformation in radio broadcasts using Gemini 1.5 - 7th November 2024