why does this unpacking work

John Salerno johnjsal at NOSPAMgmail.com
Fri Oct 20 22:20:11 CEST 2006


johnzenger at gmail.com wrote:
> It's just sequence unpacking.  Did you know that this works?:
> 
> pair = ("California","San Francisco")
> state, city = pair
> print city
> # 'San Francisco'
> print state
> # 'California'

Yes, I understand that. What confused me was if it had been written like 
this:

pair = (("California","San Francisco"))



More information about the Python-list mailing list