a question about map object

Jp Calderone exarkun at intarweb.us
Mon Mar 17 08:30:25 CET 2003


On Mon, Mar 17, 2003 at 03:07:52PM +0800, Frank Zheng wrote:
>
> [snip - demonstration that a dict is not an ordered sequence]
> 
> i think the map is a ordered-sequences, but what should i do can keep its
> order be same with input order

  Nope.  In Python maps (or "dictionaries") are un-ordered.  If order is
important to you, you'll need a different data structure, such as a list
(possibly in combination with a dictionary).

  Jp

-- 
"Minerals are inexhaustible and will never be depleted. A stream of
investment creates additions to proved reserves, a very large in-ground
inventory, constantly renewed as it is extracted... How much was in the
ground at the start and how much will be left at the end are unknown and
irrelevant."  -- Morry Adelman, World Renowned Economist
-- 
 up 13 days, 23:59, 5 users, load average: 0.18, 0.08, 0.08





More information about the Python-list mailing list