Re: Using for... for multiple lists

2005-03-06 Thread Harlin Seritt
Actually the sequences are of the same length. Forgot to mention that. thanks, Harlin -- http://mail.python.org/mailman/listinfo/python-list

Re: Using for... for multiple lists

2005-03-06 Thread gene . tani
If sequences are not same length: zip truncates to length of shortest input sequence map(None, seq1, seq2) pads to length of longest seq. (can't remember what itertools.izip() does) -- http://mail.python.org/mailman/listinfo/python-list

Re: Using for... for multiple lists

2005-03-06 Thread Heiko Wundram
On Sunday 06 March 2005 13:09, Harlin Seritt wrote: > for i, f in filelist, self.checkbox: >if f.get(): > print i Use: for i, f in zip(filelist,self.checkbox): -- --- Heiko. pgpuQ4Xv4IUj6.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Using for... for multiple lists

2005-03-06 Thread Diez B. Roggisch
> Both filelist and self.checkbox are the same size (4 items btw). Is > there any way to get this done? Use zip: a, b = [1,2,3], ['a', 'b', 'c'] for i,j in zip(a,b): print i,j Or from itertools izip - which should be slightly more performant and less memory consuming. -- Regards, Diez B.

Using for... for multiple lists

2005-03-06 Thread Harlin Seritt
I am using the following code: for i, f in filelist, self.checkbox: if f.get(): print i I am getting an error: Exception in Tkinter callback Traceback (most recent call last): File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) File "install.