[Python-Dev] if key in dict?

Greg Stein gstein@lyra.org
Thu, 13 Apr 2000 04:19:32 -0700 (PDT)


On Thu, 13 Apr 2000, Fredrik Lundh wrote:
> now that we have the sq_contains slot, would it make
> sense to add support for "key in dict" ?
> 
> after all,
> 
>     if key in dict:
>         ...

The counter has always been, "but couldn't that be read as 'if value in
dict' ??"

Or maybe 'if (key, value) in dict' ??

People have different impressions of what "in" should mean for a dict. And
some people change their impression from one function to the next :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/