testing and debugging forgotten the (that turns reference to an object of type function into function invocationo created an unintentional aliasor made any other mistake that is typical for you stop asking yourself why the program isn' doing what you want it to insteadask yourself why it is doing what it is that should be an easier question to answerand will probably be good first step in figuring out how to fix the program keep in mind that the bug is probably not where you think it is if it wereyou would probably have found it long ago one practical way to go about deciding where to look is asking where the bug cannot be as sherlock holmes said"eliminate all other factorsand the one which remains must be the truth " try to explain the problem to somebody else we all develop blind spots it is often the case that merely attempting to explain the problem to someone will lead you to see things you have missed good thing to try to explain is why the bug cannot be in certain places don' believe everything you read in particulardon' believe the documentation the code may not be doing what the comments suggest stop debugging and start writing documentation this will help you approach the problem from different perspective walk awayand try again tomorrow this may mean that bug is fixed later in time than if you had stuck with itbut you will probably spend lot less of your time looking for it that isit is possible to trade latency for efficiency (studentsthis is an excellent reason to start work on programming problem sets earlier rather than later!and when you have found "thebug when you think you have found bug in your codethe temptation to start coding and testing fix is almost irresistible it is often betterhoweverto slow down little remember that the goal is not to fix one bugbut to move rapidly and efficiently towards bug-free program ask yourself if this bug explains all the observed symptomsor whether it is just the tip of the iceberg if the latterit may be better to think about taking care of this bug in concert with other changes supposefor examplethat you have discovered that the bug is the result of having accidentally mutated list you could circumvent the problem locally (perhaps by making copy of the list)or you could consider using tuple instead of list (since tuples are immutable)perhaps eliminating similar bugs elsewhere in the code before making any changetry and understand the ramification of the proposed "fix will it break something elsedoes it introduce excessive complexitydoes it offer the opportunity to tidy up other parts of the code arthur conan doyle"the sign of the four