A small debug function that takes an iterable of (x, y) integer tuples
    and draws them to the screen.

def drawPoints(points, bg=','):
    """A small debug function that takes an iterable of (x, y) integer tuples
    and draws them to the screen."""

    # Note: I set bg to ',' instead of '.' because using ... in the docstrings
    # confuses doctest and makes it think it's Python's secondary ... prompt,
    # causing doctest errors.
    import sys
    points = list(points)
    try:
        points = [(int(x), int(y)) for x, y in points]
    except:
        raise PyBresenhamException('points must only contains (x, y) numeric tuples')

    # Calculate size of the character grid from the given points.
    minx = min([x for x, y in points])
    maxx = max([x for x, y in points])
    miny = min([y for x, y in points])
    maxy = max([y for x, y in points])

    charGrid = [[' '] * (maxy - miny + 1) for i in range(maxx - minx + 1)]

    # Draw O characters to the grid at the given points.
    for x, y in points:
        charGrid[x - minx][y - miny] = 'O'

    # Print out the character grid.
    for y in range(len(charGrid[0])):
        for x in range(len(charGrid)):
            if charGrid[x][y] in (None, ' '):
                charToDraw = bg
            else:
                charToDraw = charGrid[x][y]
            sys.stdout.write(charToDraw)
        print()