a question about map object

Frank Zheng hust_zxq524 at 263.net
Mon Mar 17 08:10:26 EST 2003


Hi, Peter:

    In fact , whether the dict has orders or not has nothing to do with my
work. I just feel curious about this.
I made a parser which receive  a stream from the handset connected to PC via
serial cable. And then the parser  can get out  every item of one phone book
entry such as name,group, home phone and so on.  I don't care about the
orders of these items because i have a dict and every item has a key. I just
feel curious about the order since it's different with the input order,.
However, i know the reason at last. There are so many good people here.

    I think my english is poor, and i don't know if u can understand me. I
am from China and i love python.

    thanks
    best regards

Frank

"Peter Hansen" <peter at engcorp.com> ??????:3E75BED8.2601C726 at engcorp.com...
> 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.")
>
> -Peter






More information about the Python-list mailing list