Re: Assigning multiple variables to a list a la php's list()

2009-05-13 Thread Chris Rebert
On Wed, May 13, 2009 at 9:17 PM, Wells wrote: > Can you take a list and have it exploded into variables w/ one > command? Something like.. > > > list = ['foo', 'bar'] > [a, b] = list > > Then 'a' would be foo and 'b' 'bar'. Did you think to try it at the interpreter? That exact syntax works, thou

Assigning multiple variables to a list a la php's list()

2009-05-13 Thread Wells
Can you take a list and have it exploded into variables w/ one command? Something like.. list = ['foo', 'bar'] [a, b] = list Then 'a' would be foo and 'b' 'bar'. Like list($a,$b) = $list in PHP. Thanks! -- http://mail.python.org/mailman/listinfo/python-list