[Tutor] Faster procedure to filter two lists . Please help

Alan Gauld alan.gauld at freenet.co.uk
Sat Jan 15 10:28:14 CET 2005


>  Thank you for your suggestion. I tried creating a
> dictionary of 'what' list and searched keys with
> has_key method and it is pretty fast. 

Use try/except and it will be faster still. The except only 
gets triggered if theres a missing entry - which in your 
case should be hardly ever! So you save a function call 
per item...

Alan G.


More information about the Tutor mailing list