self alltime +elapsed print('% (self func __name__elapsedself alltime)return result @timer def listcomp( )return [ for in range( )@timer def mapcall( )return force(map((lambda xx )range( ))result listcomp( time for this callall callsreturn value listcomp( listcomp( listcomp( print(resultprint('alltime %slistcomp alltimetotal time for all listcomp calls print(''result mapcall( mapcall( mapcall( mapcall( print(resultprint('alltime %smapcall alltimetotal time for all mapcall calls print('\ **map/comp %sround(mapcall alltime listcomp alltime )when run in either python or xthe output of this file' self-test code is as follows --giving for each function call the function nametime for this calland time for all calls so faralong with the first call' return valuecumulative time for each functionand the map-to-comprehension time ratio at the endc:\codepy - timerdeco py listcomp listcomp listcomp listcomp [ alltime mapcall mapcall mapcall mapcall [ alltime **map/comp times vary per python line and test machineof courseand cumulative time is available as class instance attribute here as usualmap calls are almost twice as slow as list decorators