[Tutor] this is ugly

Alan Gauld alan.gauld at blueyonder.co.uk
Tue Oct 21 17:32:12 EDT 2003


> A quick suggestion:
> 
>     if -1 not in [line.find(x) for x in ["KeC 923","ZEF 156","pBX 
> 88347","FZX 17255"]]:
>         # etc.

Still searches three times but at least its more maintainable.
A regex in this case will almost certainly be faster than 
repeated searching.

Alan G.




More information about the Tutor mailing list