to illustrate with simple exampleconsider program that makes use of the dict(function to create dictionaries with string keys like thiss dict(name='goog',shares= ,price= {'name':'goog''shares': 'price': programmer might create dictionaries in this way to save typing (you don' have to put quotes around the key nameshoweverthis alternative way of creating dictionary also runs much more slowly because it adds an extra function call timeit(" {'name':'goog','shares': ,'price': }" timeit(" dict(name='goog',shares= ,price= )" if your program creates millions of dictionaries as it runsthen you should know that the first approach is faster with few exceptionsany feature that adds an enhancement or changes the way in which an existing python object works will run more slowly know how classes and instances build upon dictionaries user-defined classes and instances are built using dictionaries because of thisoperations that look upsetor delete instance data are almost always going to run more slowly than directly performing these operations on dictionary if all you are doing is building simple data structure for storing dataa dictionary may be more efficient choice than defining class just to illustrate the differencehere is simple class that represents holding of stockclass stock(object)def _init_ (self,name,shares,price)self name name self shares shares self price price if you compare the performance of using this class against dictionarythe results are interesting firstlet' compare the performance of simply creating instancesfrom timeit import timeit timeit(" stock('goog', , )","from stock import stock" timeit(" {'name'goog''shares 'price }" herethe speedup of creating new objects is about nextlet' look at the performance of performing simple calculationtimeit(" shares* price""from stock import stocks stock('goog', , )" timeit(" ['shares']* ['price']"" {'name'goog''shares 'price }" herethe speedup is about the lesson here is that just because you can define new object using classit' not the only way to work with data tuples and dictionaries are often good enough using them will make your program run more quickly and use less memory lib fl ff