Map, dictionary, associative array, hash, hash table là những cái tên cho cùng một thứ

JS map or object, Python dictionary, PHP associative array, Perl hash, Common Lisp hash table

Programming languages intended for mathematicians should use the jargon of mathematics; we’d expect “map” in the sense of “function” to be in their vocabulary. A line-of-business programmer, particularly one who came to programming through business rather than academia, is more likely to think of a map as being a plot of terrain used for navigation, so a line-of-business language ought to use a less jargon-laden term such as “lookup” or “dictionary”.

“Dictionary” might be too specific though; we think of dictionaries as being functions from words to definitions, or more generally text to text, but dictionaries are often generalized key-value stores. “Keyed store” though seems to again be jargony. Design is the art of finding good compromises between many design goals. It takes judgment, and opinions will differ from designer to designer.
Nguồn:: What is the difference between JS’s map and Python’s dictionary?
Map trong JS tương đương với dictionary trong Python


Cập nhật lần cuối : 20 tháng 4, 2024
Tạo : 20 tháng 4, 2024