collections is a module that is shipped with Python and provides data containers that are alternative to Python’s general purpose built-in containers, i.e., dict, list, set, and tuple. One of these containers can be created with the function namedtuple (see Snippet 4.21), which allows annotating the tuple items with names. In line 2, we import the function namedtuple from the collections module. In line 5, we create an ad hoc class that best represents the structure of our sample data concerning Marvel characters’ names and the year they first appeared in the comic series. The first argument taken by the function is customary and regards the name of the class we are about to create. The second argument is a list with the names of the attributes included in our data structure. In line 8, we use the newly created class Rec to create a tuple, which is eventually printed as per line 11.