[Python-Dev] Re: Sets: elt in dict, lst.include
M.-A. Lemburg
mal@lemburg.com
Wed, 24 Jan 2001 14:00:28 +0100
Fredrik Lundh wrote:
>
> > 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.
+1 all the way :)
--
Marc-Andre Lemburg
______________________________________________________________________
Company: http://www.egenix.com/
Consulting: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/