from collections import namedtuple Point = namedtuple("Point", ['x', 'y']) p = Point(3, 5) print(p.x, p.y) #using attributes print(p[0], p[1]) # using indexes
from collections import namedtuple Point = namedtuple("Point", ['x', 'y']) p = Point(3, 5) print(p.x, p.y) #using attributes print(p[0], p[1]) # using indexes