newbie: dictionary - howto get key value

Peter Hansen peter at engcorp.com
Sat Mar 12 08:15:23 EST 2005


John Machin wrote:
>>G. Völkl wrote:
>>>I use a dictionary:
>>>phone = {'mike':10,'sue':8,'john':3}
> 
> Of course in the real world using given name as a unique key is
> ludicrous: 'mike' is a.k.a. 'michael' (or 'mikhail' or 'michele' (which
> may be a typo for 'michelle')), and if there's only one 'sue' in your
> little black book you need to get out more :-)

Maybe they're the names of his children... ;-)

Of course, one could have multiple children with the
same name under any or all of the following conditions:

1. insanity (perhaps of the parents or the children?)
2. remarriage (i.e. step-children)
3. sheer forgetfulness
4. laziness ("meet Brian, Brian, and Brian")

This last is the closest I can come to making this post
on-topic...  sorry! :-)

-Peter



More information about the Python-list mailing list