def commas(N):
    """
    Format positive integer-like N for display with
    commas between digits grouping: "XXX,YYY,ZZZ"
    """
    digits = str(N)
    assert(digits.isdigit())
    result = ''
    while digits:
        digits, last3 = digits[:-3], digits[-3:]
        result = (last3 + ',' + result) if result else last3
    return result