Quickly comment out block of code in Python
While debugging a python module I needed to remove sections of code for quick functionality testing. For those not familiar with python the hash (#) character is used to comment out a single line of code, so how do you comment out a large block of code ?
One solution could be to employ a macro on your editor to hash each line in a section of the code or a simple if statement could be used, for example :-Show Plain Text
- if 0:
However, the easiest way I've found is to use three quotes on a line either side of your block of code, with this solution you don't need to indent or de-indent your code as with the if statement method, for example :-Show Plain Text
If you know of a better better way feel free to post a comment...