文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>python dictionary

python dictionary

时间:2010-08-31  来源:菜刀大侠

<<learning python>>
dictionary:
Accessed by key, not offset
Dictionaries are sometimes called associative arrays or hashes. They associate a set
of values with keys, so you can fetch an item out of a dictionary using the key under
which you originally stored it. You use the same indexing operation to get components
in a dictionary as you do in a list, but the index takes the form of a key,
not a relative offset.

Unordered collections of arbitrary objects
Unlike in a list, items stored in a dictionary aren’t kept in any particular order; in
fact, Python randomizes their left-to-right order to provide quick lookup. Keys
provide the symbolic (not physical) locations of items in a dictionary.

Variable-length, heterogeneous, and arbitrarily nestable
Like lists, dictionaries can grow and shrink in-place (without new copies being
made), they can contain objects of any type, and they support nesting to any depth
(they can contain lists, other dictionaries, and so on).

Of the category “mutable mapping”
Dictionaries can be changed in-place by assigning to indexes (they are mutable),
but they don’t support the sequence operations that work on strings and lists.
Because dictionaries are unordered collections, operations that depend on a fixed
positional order (e.g., concatenation, slicing) don’t make sense. Instead, dictionaries
are the only built-in representatives of the mapping type category (objects
that map keys to values).

Tables of object references (hash tables)
If lists are arrays of object references that support access by position, dictionaries
are unordered tables of object references that support access by key. Internally,
dictionaries are implemented as hash tables (data structures that support very fast
retrieval), which start small and grow on demand. Moreover, Python employs optimized
hashing algorithms to find keys, so retrieval is quick. Like lists, dictionaries
store object references (not copies).

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载