in many languages there are also some examples of using par tial(discussed above the remainder of the functools module is generally devoted to useful decoratorswhich is the topic of the next section decorators although it is--by design--easy to forget itprobably the most common use of higher-order functions in python is as decorators decorator is just syntax sugar that takes function as an argumentand if it is programmed correctlyreturns new function that is in some way an enhancement of the original function (or methodor classjust to remind readersthese two snippets of code defining some_func and other_func are equivalent@enhanced def some_func(*args)pass def other_func(*args)pass other_func enhanced(other_funcused with the decorator syntaxof coursethe higher-order function is necessarily used at definition time for function for their intended purposethis is usually when they are best applied but the same decorator function can alwaysin principlebe used elsewhere in programfor example in more dynamic way ( mapping decorator function across runtime-generated collection of other functionsthat would be an unusual use casehowever decorators are used in many places in the standard library and in common third-party libraries in some ways they tie in with an idea that used to be called "aspect-oriented programming for examplethe decorator function asyncio coroutine is used to mark function as coroutine within functools the three important decorator functions are functools lru_cachefunctools total_orderingand functools wraps the first "memoizesa function ( it caches the arguments passed and returns stored values rather than performing new computation or /othe second makes it easier to write custom classes that want to use inequality operators the last makes it easier to write new decorators all of these are important decorators