Re: finding sublist

2005-08-03 Thread Johan Lindberg
> thanks everyone. only a question. there is a way to advantage of binary > sequences? I doubt you'll find any way to optimize the code that somehow only applies to binary sequences. You still have to find each possible subsequence of minimum length within the sequence and compare it to all other

Re: finding sublist

2005-08-02 Thread giampiero mu
controlla("12345678") -> "12345678" thanks everyone. only a question. there is a way to advantage of binary sequences? -- http://mail.python.org/mailman/listinfo/python-list

Re: finding sublist

2005-08-02 Thread Johan Lindberg
Hello. > my target is implement a function controlla(string - a binary string-) > that check if there is in a string two equal not overlapping > subsequences at least of length limitem: > > my code: > [snip] > I may have misunderstood it, but does your function work the way you want it to? >>>co

Re: finding sublist

2005-08-02 Thread Ron Adam
giampiero mu wrote: > hi everyone Hi, you appear to be fairly new to Python, so you might want to take a look at the tutorial at Python.org Kents suggestion to use RE is good. This should be faster than your example by quite a bit if you don't want to use RE. def controlla(test, size=4):

Re: finding sublist

2005-08-02 Thread Kent Johnson
giampiero mu wrote: > hi everyone > > my target is implement a function controlla(string - a binary string-) > that check if there is in a string two equal not overlapping > subsequences at least of length limitem: You can do this with a regular expression: >>> import re >>> r=re.compile(r'(?P

finding sublist

2005-08-02 Thread giampiero mu
hi everyone my target is implement a function controlla(string - a binary string-) that check if there is in a string two equal not overlapping subsequences at least of length limitem: my code: def controlla(test): # print test limitem=4 lunghezz=len(test) l1=lungh