Python/named tuple magic
import collectionscompany = collections.namedtuple('company', 'ceo, ticker, price')
Create instances from lists
# load some data from a list, e.g.:Get Olivier Cruchant’s stories in your inbox
Join Medium for free to get updates from this writer.
data = [‘Jeff Bezos’, ‘AMZN’, 997]# _make method
Amazon = company._make(data)# or list unpacking; same result
Amazon = company(*data)
Get data back
Amazon.ticker







