price in stocklistthe downside to named tuple is that attribute access is not as efficient as with class for exampleaccessing shares is more than twice as slow if is an instance of named tuple instead of an ordinary class named tuples are frequently used in other parts of the python standard library heretheir use is partly historical--in many library modulestuples were originally used as the return value of various functions that would return information about filesstack framesor other low-level details code that used these tuples wasn' always so elegant thusthe switch to named tuple was made to clean up their usage without breaking backwards compatibility another subtle problem with tuples is that once you start using tuplethe expected number of fields is locked forever ( if you suddenly add new fieldold code will breakvariants of named tuples have been used in the library to add new fields to the data returned by certain functions for examplean object might support legacy tuple interfacebut then provide additional values that are only available as named attributes abstract base classes the collections module defines series of abstract base classes the purpose of these classes is to describe programming interfaces on various kinds of containers such as listssetsand dictionaries there are two primary uses of these classes firstthey can be used as base class for user-defined objects that want to emulate the functionality of built-in container types secondthey can be used for type checking for exampleif you wanted to check that worked like sequenceyou could use isinstance(scollections sequencecontainer base class for all containers defines single abstract method _contains_ ()which implements the in operator hashable base class for objects that can be used as hash table key defines single abstract method _hash_ (iterable base class for objects that support the iteration protocol defines single abstract method _iter_ (iterator base class for iterator objects defines the abstract method next(but also inherits from iterable and provides default implementation of _iter_ (that simply does nothing sized base class for containers whose size can be determined defines the abstract method _len_ (callable base class for objects that support function call defines the abstract method _call_ ( lib fl ff