John Roth wrote:
> Aahz wrote:
> > The following line of lightly munged code was found in a publicly
> > available Python library...
> >
> >     if schema.elements.has_key(key) is False:
> >
> > Sorry, just had to vent.
> > --
> > Aahz ([EMAIL PROTECTED])           <*>         http://www.pythoncraft.com/
>
> Uh, guys. IMO, the clearest way of writing this is:
>
> if key not in schema.elements:
>     whatever...
>

Uh, guys, what? You are the 3rd to make that point. Therefore it must
be true.

> Unless, of course, your code has to run in a
> Python release earlier than 2.2. But then you
> wouldn't be testing for the False object anyway.
> 
> 
> 
> John Roth

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to