a question about map object

Peter Hansen peter at engcorp.com
Mon Mar 17 13:26:00 CET 2003

Frank Zheng wrote:
> i have a map object:
> then,i want to list all the keys:
> u will find the orders of keys have been changed
> i think the map is a ordered-sequences, but what should 
> i do can keep its order be same with input order

To quote Brian Quinlan's excellent response to your question
about strings in another thread, "What problem are you trying 
to solve?"

Hint: when posting a question like this, it is always going to
make it easier on us, and produce more effective answers for 
you, if you explain in more detail why you are trying to do
what you think you ought to be doing.  For example, in this case,
why are you using a dict, and why is it important that the 
results be listed in a particular input order.  Sometimes
the answer will be much simpler if we know that (e.g. we
might just say, "ah, you don't want a dict here", or we
might say "oh, yuck, for that you'll have to use this gross
construction involving a dict, two tuples, and a small 
Corgi dog.")


More information about the Python-list mailing list