decorators versus per-call timing for comparisonsee for nondecorator approach to timing iteration alternatives like these as reviewwe saw two per-call timing techniques therehomegrown and library--here deployed to time the list comprehension case of the decorator' test codethough incurring extra costs for management code including an outer loop and function callsdef listcomp( )[ for in range( ) techniques import timer timer total( listcomp ( noneimport timeit timeit timeit(number= stmt=lambdalistcomp( ) in this specific casea nondecorator approach would allow the subject functions to be used with or without timingbut it would also complicate the call signature when timing is desired--we' need to add code at every call instead of once at the def moreoverin the nondecorator scheme there would be no direct way to guarantee that all list builder calls in program are routed through timer logicshort of finding and potentially changing them all this may make it difficult to collect cumulative data for all calls in generaldecorators may be preferred when functions are already deployed as part of larger systemand may not be easily passed to analysis functions at calls on the other handbecause decorators charge each call to function with augmentation logica nondecorator approach may be better if you wish to augment calls more selectively as usualdifferent tools serve different roles timer call portability and new options in also see ' more complete handling and selection of time module functionsas well as its sidebar concerning the new and improved timer functions in this module available as of python ( perf_counterwe're taking simplistic approach here for both brevity and version neutralitybut time clock may not be best on some platforms even prior to and platform or version tests may be required outside windows testing subtleties notice how this script uses its force setting to make it portable between and as described in the map built-in returns an iterable that generates results on demand in xbut an actual list in hence ' map by itself doesn' compare directly to list comprehension' work in factwithout wrapping it in list call to coding function decorators