I just looked through the official tutorial and Dive into Python, and didn't find anything about it in either of those places. While this feature is documented in the language reference, it does not seem to be a well-known feature (another example: at least one other person did not know about it).
On 5/28/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Well, I'm sorry for bothering his majesty with such a stupid idea. At > least one other person didn't know about it either... > > On 5/28/08, Mike Klaas <[EMAIL PROTECTED]> wrote: >> >> On 28-May-08, at 6:23 PM, Daniel Wong wrote: >> >>> Currently, I must do the following instead: >>> >>> for n, pair in enumerate(list_of_pairs): >>> a, b = pair >>> ... >>> >>> <> >>> Thoughts? >> >> I find it hard to believe that you have even attempted this, which has >> been valid in python for ages: >> >> >>> for x, (a, b) in enumerate([(1,2), (3,4), (5,6)]): >> print x, a, b >> >> 0 1 2 >> 1 3 4 >> 2 5 6 >> >> -Mike >> > _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com