emulating an and operator in regular expressions

2005-01-02 Thread Ross La Haye
How can an and operator be emulated in regular expressions in Python? Specifically, I want to return a match on a string if and only if 2 or more substrings all appear in the string. For example, for a string s = 'Jones John' and substrings sg0 = 'Jones' and sg1 = 'John', I want to return a

justifying text...and also...correct use of classes...

2004-12-29 Thread Ross La Haye
Few questions. I have a module combin which contains Combin and Prob classes. This is the Prob class: class Prob: def binprob(self,n,k,p): fewerthan = sum([Combin().kcomb(n,i)*((p**i)*(1-p)**(n-i)) for i in range(k)]) exact = Combin().kcomb(n,k)*((p**k)*(1-p)**(n-k))