from collections import namedtuple
State = namedtuple('State', 'p me you pending')
s = State(1,2,3,4)
In [33]: s.p
Out[33]: 1
In [34]: s.me
Out[34]: 2
In [35]: s.you
Out[35]: 3
In [36]: s.pending
Out[36]: 4
namedtuple 可以为tuple中每个元素赋予有意义的名字
from collections import namedtuple
State = namedtuple('State', 'p me you pending')
s = State(1,2,3,4)
In [33]: s.p
Out[33]: 1
In [34]: s.me
Out[34]: 2
In [35]: s.you
Out[35]: 3
In [36]: s.pending
Out[36]: 4
namedtuple 可以为tuple中每个元素赋予有意义的名字