from collections import namedtuple A = namedtuple('A', 'a b c') a = A(1,2,3) a.b == a[1] # == 2 a == A(1,2,3) # is True a[2] = 5 # TypeError: 'A' object does not support item assignment len(a) # == 3 type(a) # <class '__main__.A'>