> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Shane Geiger > Sent: Wednesday, March 12, 2008 10:33 AM > To: Michael Wieher > Cc: python-list@python.org > Subject: Re: List Combinations > > > > > > def gen(lists): > out = '[' + ','.join(["v%s" % i for i in range(len(lists))]) + ']' > comp = ''.join([ " for v%d in lists[%d]" % (i, i) for i in > range(len(lists))]) > return eval('[ ' + out + comp + ' ]') > > a,b,c = [1,2,3],[4,5,6],[7,8,9] > > print gen([a, b, c]) > > > > > > -- > Shane Geiger > IT Director > National Council on Economic Education > [EMAIL PROTECTED] | 402-438-8958 | http://www.ncee.net >
It helps to quote your source... http://www.mail-archive.com/python-list@python.org/msg178457.html Start here http://www.mail-archive.com/python-list@python.org/msg178356.html and go through the thread. There are several ways to solve the problem and we evaluated the performance and 'pythonicity' of each. ***** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA625 -- http://mail.python.org/mailman/listinfo/python-list