Namedtuple is amaziing, but this question confusing me for a long time.
In the python docs namedtuple
collections.namedtuple(typename, field_names, *, rename=False, defaults=None, module=None)
It's Basic exmaple as
Point = namedtuple('Point', ['x', 'y'])
EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade')
I think it's more facile and tuple-like to define a namedtuple as
Point = namedtuple(['x', 'y'])
EmployeeRecord = namedtuple('name, age, title, department, paygrade')
What's the reason that namedtuple
should be implementd with a verbose typename
?