John Salerno a écrit :
> [EMAIL PROTECTED] 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"))


Python 2.4.1 (#1, Jul 23 2005, 00:37:37)
[GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on 
linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> (("California","San Francisco")) == ("California","San Francisco")
True
pair = "California","San Francisco"
 >>> pair
('California', 'San Francisco')
 >>> t = 1,
 >>> t
(1,)
 >>> t = 1, 2
 >>> t
(1, 2)
 >>>

HTH



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to