finallywhile slots primarily optimize memory usetheir speed impact is less clear-cut here' simple test script using the timeit techniques we studied in for both the slots and nonslots (instance dictionarystorage modelsit makes , instancesassigns and fetches attributes on eachand repeats , times--for both models taking the best of runs that each exercise total of attribute operationsfile slots-test py from __future__ import print_function import timeit base ""is [for in range( ) ( is append( ""stmt ""class c__slots__ [' '' '' '' '""base print('slots =>'end='print(min(timeit repeat(stmtnumber= repeat= ))stmt ""class cpass ""base print('nonslots=>'end='print(min(timeit repeat(stmtnumber= repeat= ))at least on this codeon my laptopand in my installed versions (python and )the best times imply that slots are slightly quicker in and wash in xthough this says little about memory spaceand is prone to change arbitrarily in the futurec:\codepy - slots-test py slots = nonslots= :\codepy - slots-test py slots = nonslots= for more on slots in generalsee the python standard manual set also watch for the private decorator case study of --an example that naturally allows for attributes based on both __slots__ and __dict__ storageby using delegation and storageneutral accessor tools like getattr new-style class extensions