Creating a Profiling Function Wrapper

  • Share this:

Code introduction


Create a function that returns another function, which uses cProfile to profile the call to print the arguments.


Technology Stack : Built-in library: cProfile

Code Type : Function

Code Difficulty : Intermediate


                
                    
def aaaa(arg1, arg2):
    def bbbb():
        import cProfile
        cProfile.run('print(arg1, arg2)')
    
    return bbbb