dketov
12/12/2011 - 12:35 PM

Переменные

Переменные

# -*- encoding: utf-8 -*-
"""
Групповое присваивание
"""

v = ('a', 'b', 'e') 
(x, y, z) = v                                      

print x 
print y 
print z 
# -*- encoding: utf-8 -*-
"""
'Перечисление'
"""

print range(7)                                                                    

(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY) = range(7) 

print MONDAY                                                                      
print TUESDAY 
print SUNDAY 
# -*- encoding: utf-8 -*-
"""
Цепочечное присваивание
"""

x = y = z = 0  # Zero x, y and z

print x
print y
print z
# -*- encoding: utf-8 -*-
"""
Динамическая типизация
"""

x = 0            # x bound to an integer object
print x

x = "Hello"      # now it's a string
print x

x = [1, 2, 3]    # and now it's a list
print x