A proper debug in Anaconda (or Spyder) is perhaps one of the most appealing functionality of an Integrated Developing Environment (IDE). In the case you are wondering what is the meaning of debug you can refer to the following:
Debug refers to the process of identifying and removing errors from computer hardware or software.
Definition of Debug
This is not the only benefit of using an IDE for developing your code and this article presents the full list of feature. However for the purpose of this post we will try to understand how to do a debug in Anaconda. Practically speaking, your working environment (Spyder in this case) can keep track of the value of each single variable that you are using as well as execute the code that you wrote line by line. In this way you can jump into the portion of code that you need to investigate (debug) and see how all the critical aspects evolves. If it sound too theoretical and abstract to you I think that an example will be beneficial. In the video below you how debug in Anacoda works in practice:
How to Debug in Anaconda using SpyderThis second video discuss a practical problem. In particular shows how to use the debugger for understanding why a portion of code is simultaneously execute the “then part” and the “else part” of an if-then-else. This is clearly impossible and therefore there is an error in the code.
Clearly you could be able to spot this problem without the need of a debugger. However, this tools, once you start getting familiar with its potential, makes your job easy. Let me add that once you will know how to use it you will never go back to an environment that do not offer you this functionality!
These videos cover the most useful functionalities and with them you will be able to cover 80-90% of your practical needs. For the full list of functionalities I would recommend you to visit the official documentation of the Spyder at the following link:
- Debug in Anaconda using the Spyder: full documentation