Re: Multiple tuples for one for statement

2005-04-25 Thread Ivan Van Laningham
Peter Hansen wrote: > > Ivan Van Laningham wrote: > > I can see that now. I had three hours sleep last night and my brain > > hurts, so I don't get it. I seek enlightenment. > > So do I: did you mean you don't even "get" what > my code is doing...? Yes. I barely remember my own name right n

Re: Multiple tuples for one for statement

2005-04-25 Thread Peter Hansen
Ivan Van Laningham wrote: I can see that now. I had three hours sleep last night and my brain hurts, so I don't get it. I seek enlightenment. So do I: did you mean you don't even "get" what my code is doing, or you don't get what the OP really wanted, or something else? (My sample works only beca

Re: Multiple tuples for one for statement

2005-04-25 Thread Ivan Van Laningham
Hi All-- Peter Hansen wrote: > > > Define "works": > > >>> a = (1,2,3) > >>> b = ('a','b','c') > >>> c = (None, 'foo', 3.14) > >>> tup1 = (1,2,3) > >>> tup2 = ('a','b','c') > >>> tup3 = (None, 'foo', 3.14) > >>> for a,b,c in (tup1,tup2,tup3): > ... print a > ... print b > ... print

Re: Multiple tuples for one for statement

2005-04-25 Thread Peter Hansen
Ivan Van Laningham wrote: "R. C. James Harlow" wrote: On Monday 25 April 2005 14:34, Ivan Van Laningham wrote: "R. C. James Harlow" wrote: or just: for a,b,c in (tup1, tup2, tup3): print a print b print c And this works in Python version??? Ah, reading the replies to the original post, thi

Re: Multiple tuples for one for statement

2005-04-25 Thread Ivan Van Laningham
Hi All-- "R. C. James Harlow" wrote: > > On Monday 25 April 2005 14:34, Ivan Van Laningham wrote: > > Hi All-- > > > > "R. C. James Harlow" wrote: > > > or just: > > > > > > for a,b,c in (tup1, tup2, tup3): > > > print a > > > print b > > > print c > > > > And this works in Python ver

Re: Multiple tuples for one for statement

2005-04-25 Thread R. C. James Harlow
On Monday 25 April 2005 14:34, Ivan Van Laningham wrote: > Hi All-- > > "R. C. James Harlow" wrote: > > or just: > > > > for a,b,c in (tup1, tup2, tup3): > > print a > > print b > > print c > > And this works in Python version??? Ah, reading the replies to the original post, this works

Re: Multiple tuples for one for statement

2005-04-25 Thread Ivan Van Laningham
Hi All-- "R. C. James Harlow" wrote: > > or just: > > for a,b,c in (tup1, tup2, tup3): > print a > print b > print c > And this works in Python version??? Metta, Ivan -- Ivan Van Laningham God N Locomotive Works http://www.andi-holmes.co

Re: Multiple tuples for one for statement

2005-04-25 Thread R. C. James Harlow
On Monday 25 April 2005 04:20, James Stroud wrote: > for a,b,c in zip(tup1, tup2, tup3): >print a >print b >print c or just: for a,b,c in (tup1, tup2, tup3): print a print b print c pgpJ0RNTnCUA3.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/

Re: Multiple tuples for one for statement

2005-04-24 Thread Daniel Cer
Harlin Seritt wrote: I have three tuples of the same size: tup1, tup2, tup3 I'd like to do something like this: for a,b,c in tup1, tup2, tup3: print a print b print c Of course, you get an error when you try to run the pseudocode above. What is the correct way to get this done? For somethi

Re: Multiple tuples for one for statement

2005-04-24 Thread Harlin Seritt
Thank you Mr. Stroud. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple tuples for one for statement

2005-04-24 Thread Kent Johnson
Harlin Seritt wrote: I have three tuples of the same size: tup1, tup2, tup3 I'd like to do something like this: for a,b,c in tup1, tup2, tup3: print a print b print c Presuming that you want a,b,c to be corresponding entries from the three tuples, then zip() is your friend: for a,b,c in z

Re: Multiple tuples for one for statement

2005-04-24 Thread Steven Bethard
Harlin Seritt wrote: I have three tuples of the same size: tup1, tup2, tup3 I'd like to do something like this: for a,b,c in tup1, tup2, tup3: print a print b print c Of course, you get an error when you try to run the pseudocode above. What is the correct way to get this done? for a, b, c

Re: Multiple tuples for one for statement

2005-04-24 Thread James Stroud
for a,b,c in zip(tup1, tup2, tup3): print a print b print c -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Multiple tuples for one for statement

2005-04-24 Thread Harlin Seritt
I have three tuples of the same size: tup1, tup2, tup3 I'd like to do something like this: for a,b,c in tup1, tup2, tup3: print a print b print c Of course, you get an error when you try to run the pseudocode above. What is the correct way to get this done? Thanks, Harlin -- http://