[Python-Dev] Re: Sets: elt in dict, lst.include

Fredrik Lundh fredrik@effbot.org
Wed, 24 Jan 2001 01:13:20 +0100

> It's come up before. The problem with it is that it's not quite obvious
> whether it is 'if key in dict' or 'if value in dict'.

you forgot "if (key, value) in dict"

on the other hand, it's not quite obvious that "list.sort"
doesn't return the sorted list, "print >>None" prints to
standard output, "except KeyError, ValueError" doesn't
catch a ValueError exception, etc, etc, etc.

(nor that it's "has_key" and "hasattr", and not "has_key"
and "has_attr" or "haskey" and "hasattr" ;-)

let's just say that "in" is the same thing as "has_key",
and be done with it.

Cheers /F