I'm currently learning Python and to be aware of what's going on behind the scenes I write a lot of printouts. Seeing as it's quite a fuss to go back and comment all the messages I've started writing a module where I set all the messages in the method I want to use them and then use a boolean to turn the messages off and on. Problem is, I get None printouts instead of my debug messages which isn't very elegant. Any way to get around this?
Some sample code:
def setDebug(bool):
'''
Toggles the debug messages
'''
global _debug
_debug = bool
def setNewMsg(msg):
'''
Appends a new debug message to the list
'''
global _debugMsg
_debugMsg.append(msg)
def getDebugMsg(index):
'''
Takes an int for a parameter and returns the debug message needed
'''
global _debug
global _debugMsg
if _debug == True:
return _debugMsg[index]
else:
return