jdonnell wrote:
> I want to check if a value is in an array. I'm currently doing it as
> follows, but I just don't like this way of doing it. It seems
> unpythonic.
> 
> fieldIsRequired = true
> try:
>     notRequiredAry.index(k)
>     fieldIsRequired = false
> except ValueError:
>     pass

fieldIsRequired = not (k in notRequiredAry)

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

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

Reply via email to