> ki lo wrote: > > I have type variable which may have been set to 'D' or 'E' > > > > Now, which one of following statements are more efficient > > > > if type =='D' or type == 'E': > > > > or > > > > if re.search("D|E", type): > > > > Please let me know because the function is going to called 10s of millions > > of times. > > For maximum efficiency you have to use a set.
if type in 'DE': ... might be faster. Really the only way to know is make actual measurements. -- http://mail.python.org/mailman/listinfo/python-list