testingdebuggingprofilingand tuning in this casethe debugger is launched automatically at the beginning of program startup where you are free to set breakpoints and make other configuration changes to make the program runsimply use the continue command for exampleif you wanted to debug the split(function from within program that used ityou might do thispython - pdb someprogram py /users/beazley/code/someprogram py( )(-import splitter (pdbb splitter split breakpoint at /users/beazley/code/splitter py: (pdbc /users/beazley/code/splitter py( )split(-fields line split(delimiter(pdbconfiguring the debugger if pdbrc file exists in the user' home directory or in the current directoryit' read in and executed as if it had been typed at the debugger prompt this can be useful for specifying debugging commands that you want to execute each time the debugger is started (as opposed to having to interactively type the commands each timeprogram profiling the profile and cprofile modules are used to collect profiling information both modules work in the same waybut cprofile is implemented as extensionis significantly fasterand is more modern either module is used to collect both coverage information (that iswhat functions get executedas well as performance statistics the easiest way to profile program is to execute it from the command line as followspython - cprofile someprogram py alternativelythe following function in the profile module can be usedrun(command [filename]executes the contents of command using the exec statement under the profiler filename is the name of file in which raw profiling data is saved if it' omitteda report is printed to standard output the result of running the profiler is report such as the following function calls ( primitive callsin cpu seconds ordered bystandard name ncalls tottime percall cumtime percall filename:lineno(function : (? / book py: (process book py: (? exceptions py: ( _init_ profile: (execfile('book py') profile: (profilerdifferent parts of the report generated by run(are interpreted as followsf lib fl ff