Skip to content

Instantly share code, notes, and snippets.

@cmower
Last active May 20, 2022 07:34
Show Gist options
  • Save cmower/95e60c8602facef6f6568917db73e94a to your computer and use it in GitHub Desktop.
Save cmower/95e60c8602facef6f6568917db73e94a to your computer and use it in GitHub Desktop.
Python debugging
class Debugger:
"""Simple class for debugging"""
def __init__(self):
self.it = 0
def __call__(self, msg=''):
print('-'*40, f'DEBUG {self.it} {msg}', end=(' ' if msg else '') +'-'*40)
self.it += 1
def example():
debug = Debugger()
debug('start code here')
#
# Write some potetially buggy code!
#
debug('end code here')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment