Re: for x,y in word1, word2 ?

2008-08-12 Thread Raja Baz
On Sun, 10 Aug 2008 21:40:55 -0700, Mensanator wrote: On Aug 10, 11:18�pm, ssecorp [EMAIL PROTECTED] wrote: Is there a syntax for looping through 2 iterables at the same time? for x in y: � � for a in b: is not what I want. I want: for x in y and for a in b: Something like this? a

Re: for x,y in word1, word2 ?

2008-08-12 Thread Paul Rubin
ssecorp [EMAIL PROTECTED] writes: for x in y and for a in b: for x,a in zip(y,b): ... or the iterator version: from itertools import izip for x,a in izip(y,b): ... avoids allocating a list to iterate through. -- http://mail.python.org/mailman/listinfo/python-list

Re: for x,y in word1, word2 ?

2008-08-11 Thread ssecorp
On Aug 11, 6:40 am, Mensanator [EMAIL PROTECTED] wrote: On Aug 10, 11:18 pm, ssecorp [EMAIL PROTECTED] wrote: Is there a syntax for looping through 2 iterables at the same time? for x in y: for a in b: is not what I want. I want: for x in y and for a in b: Something like this?

Re: for x,y in word1, word2 ?

2008-08-11 Thread Jon Clements
On Aug 11, 5:40 am, Mensanator [EMAIL PROTECTED] wrote: On Aug 10, 11:18 pm, ssecorp [EMAIL PROTECTED] wrote: Is there a syntax for looping through 2 iterables at the same time? for x in y: for a in b: is not what I want. I want: for x in y and for a in b: Something like this?

Re: for x,y in word1, word2 ?

2008-08-11 Thread [EMAIL PROTECTED]
On Aug 10, 11:14 pm, ssecorp [EMAIL PROTECTED] wrote: On Aug 11, 6:40 am, Mensanator [EMAIL PROTECTED] wrote: On Aug 10, 11:18 pm, ssecorp [EMAIL PROTECTED] wrote: Is there a syntax for looping through 2 iterables at the same time? for x in y: for a in b: is not what I want.

Re: for x,y in word1, word2 ?

2008-08-11 Thread Marc 'BlackJack' Rintsch
On Sun, 10 Aug 2008 23:14:50 -0700, ssecorp wrote: I know zip but lets say I have a word painter and I want to compare it to a customer's spelling, he might have written paintor and I want to check how many letters are the same. Now I know how I could do this, it is not hard. I am just

Re: for x,y in word1, word2 ?

2008-08-11 Thread Edwin . Madari
sounds like *soundex* is what you are looking for. google soundex regards Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc 'BlackJack' Rintsch Sent: Monday, August 11, 2008 3:09 AM To: python-list@python.org Subject: Re: for x,y in word1

Re: for x,y in word1, word2 ?

2008-08-11 Thread Casey
My first thought is that you should be looking at implementations of Hamming Distance. If you are actually looking for something like SOUNDEX you might also want to look at the double metaphor algorithm, which is significantly harder to implement but provides better matching and is less

Re: for x,y in word1, word2 ?

2008-08-11 Thread Timothy Grant
On Mon, Aug 11, 2008 at 8:44 AM, Casey [EMAIL PROTECTED] wrote: My first thought is that you should be looking at implementations of Hamming Distance. If you are actually looking for something like SOUNDEX you might also want to look at the double metaphor algorithm, which is significantly

Re: for x,y in word1, word2 ?

2008-08-11 Thread Dave Webster
Thanks, Timothy. I'm pretty sure that there is no such thing as a beautiful implementation of double-metaphone but I would personally like to have a copy of your python implementation. I have a fairly elegant version of the original metaphone algorithm I wrote myself (in PERL, many years ago)

Re: for x,y in word1, word2 ?

2008-08-11 Thread Timothy Grant
On Mon, Aug 11, 2008 at 12:13 PM, Dave Webster [EMAIL PROTECTED] wrote: Thanks, Timothy. I'm pretty sure that there is no such thing as a beautiful implementation of double-metaphone but I would personally like to have a copy of your python implementation. I have a fairly elegant version of

for x,y in word1, word2 ?

2008-08-10 Thread ssecorp
Is there a syntax for looping through 2 iterables at the same time? for x in y: for a in b: is not what I want. I want: for x in y and for a in b: -- http://mail.python.org/mailman/listinfo/python-list

Re: for x,y in word1, word2 ?

2008-08-10 Thread Mensanator
On Aug 10, 11:18�pm, ssecorp [EMAIL PROTECTED] wrote: Is there a syntax for looping through 2 iterables at the same time? for x in y: � � for a in b: is not what I want. I want: for x in y and for a in b: Something like this? a = ['a','b','c'] b = [1,2,3] zip(a,b) [('a', 1), ('b',