Skip to content

Instantly share code, notes, and snippets.

@looselycoupled
Last active August 24, 2019 19:40
Show Gist options
  • Save looselycoupled/7fd8331ad5551b35c4c1 to your computer and use it in GitHub Desktop.
Save looselycoupled/7fd8331ad5551b35c4c1 to your computer and use it in GitHub Desktop.
# pdb-demo
# Trivial file to demonstrate basic debugging techniques
#
# Author: Allen Leis <al1075@georgetown.edu>
# Created: Wed Sep 16 21:50:05 2015 -0400
#
# Copyright (C) 2015 georgetown.edu
# For license information, see LICENSE.txt
#
# ID: pdb-demo.py [] al1075@georgetown.edu $
"""
Trivial file to demonstrate basic debugging techniques
"""
##########################################################################
## Imports
##########################################################################
# import pdb
##########################################################################
## Functions
##########################################################################
def process_element(element):
"""
Fake function to perform some processing
"""
# bogus work
# ...
# set a breakpoint
# pdb.set_trace()
# print the input data
print(element)
def main(data):
"""
Loops through the input array and calls the processing function
for each data point.
"""
index = 0
while index <= len(data):
process_element(data[index])
index += 1
##########################################################################
## Execution
##########################################################################
if __name__ == '__main__':
data = [0, 1, 2, 3, 4]
main(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment