Re: Coding and Decoding in Python

2011-03-17 Thread Steven D'Aprano
On Thu, 17 Mar 2011 08:07:28 -0700, Wanderer wrote: > I have a dll that to communicate with I need to send numeric codes. So I > created a dictionary. It works in one direction in that I can address > the key and get the value. But when the program returns the value I > can't get the key. If you

Re: Coding and Decoding in Python

2011-03-17 Thread John Gordon
In <7546e476-d10f-46e5-8b20-5d9b42345...@r6g2000vbo.googlegroups.com> Wanderer writes: > I guess two keys having the same value is why dictionaries don't > return keys for values, but this is a code. Each value has a unique > meaning to both sender and receiver. The text part is for making the >

Re: Coding and Decoding in Python

2011-03-17 Thread Wanderer
On Mar 17, 11:44 am, John Gordon wrote: > In <2f4a08df-55ea-4a4e-9cc0-24e6b9f81...@f15g2000pro.googlegroups.com> > Wanderer writes: > > > But when the program returns the value I can't get the key. > > What happens when two keys have the same value?  How would you know which > key to return? > >

Re: Coding and Decoding in Python

2011-03-17 Thread John Gordon
In <2f4a08df-55ea-4a4e-9cc0-24e6b9f81...@f15g2000pro.googlegroups.com> Wanderer writes: > But when the program returns the value I can't get the key. What happens when two keys have the same value? How would you know which key to return? In your sample code all the values are different, but s

Re: Coding and Decoding in Python

2011-03-17 Thread Mel
Wanderer wrote: > I have a dll that to communicate with I need to send numeric codes. So > I created a dictionary. It works in one direction in that I can > address the key and get the value. But when the program returns the > value I can't get the key. This code is very simple and I could use a >

Coding and Decoding in Python

2011-03-17 Thread Wanderer
I have a dll that to communicate with I need to send numeric codes. So I created a dictionary. It works in one direction in that I can address the key and get the value. But when the program returns the value I can't get the key. This code is very simple and I could use a list and the index except