"in" for dicts (was: Python 2.1 function attributes)

Tom Satter tsatter at purecode.com
Sun Jan 28 23:12:00 EST 2001


"Nathaniel Gray" <n8gray at caltech.edu> wrote in message
news:3A7496A7.253B7B67 at caltech.edu...
...
>
> If I was to ask you, "Tim, is 'larch' in Webster's dictionary?" would
> you reply, "Yes, it's under 'L'", or would you reply, "No, there's no
> 'larch' section, just A,B,C,D,..."?
>
> (I know you'd _actually_ reply "Look it up yourself!" ;^)
>
> "in" just doesn't imply "has_key" for dictionaries.

Except that in Webster's dictionary, 'larch' IS a key with the definition
(basically a tree) being the value.  So I would expect that 'larch' is IN
Webster's.

Now, if you asked, "Is 'larch' in the letters of the alphabet" or "Is
'larch' in the set of letters used to index pages in Webster's dictionary"
then the answer would correctly be 'no'.

So I don't see how this is misleading.  I would not say "Is 'larch' in
Webster's dictionary", meaning is the word 'larch' used in any of
definitions (values) in the dictionary, so at least in this case it is
completely clear.

tom

--

tom -- just plain old tom
tsatter at purecode.com






More information about the Python-list mailing list