[Zope] checking for elements in a list

Chris Withers chris at simplistix.co.uk
Mon Dec 5 02:45:28 EST 2005


J Cameron Cooper wrote:
> Just make sure that the elements of the list you're getting are what you 
> think they are. If you ask about the integer 17 and the list actually 
> has a string "17" they won't match. You can either adjust what you test 
> or use something like the 'int' function to "cast".

Also make sure the list isn't too long, otherwise do it as a dictionary 
and use has_key...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope mailing list