Max Noel wrote:
> 
[snip]
> 
> 
>     While we're on that topic, is there a particular reason why  'in', 
> in a dict context, searches the keys instead of doing the  logical thing 
> and searching the values?
animals = { 'cat': "a cuddly little mammal who likes to eat birds",
'dog': "man's best friend, also a mammal and which also can eat birds",
'parrot': "a bird, favoured by Monty Python"}

What is more natural?

if parrot in animals: ....

or

if "a bird, favoured by Monty Python" in animals: ...

André

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to