def dotDotRange(dotDotString):
    """
    A method for generating integers.
    For example:

> for i in util.dotDotRange("1..4,100,-1..1"): print i
1
2
3
4
100
-1
0
1

    """
    for intervalString in dotDotString.split(','):
        parts = intervalString.split('..')
        if len(parts) > 2:
            raise Exception("Expect at most one '..' between commas. (see {0})"
                .format(intervalString))
        start = int(parts[0])
        if len(parts) == 1:
            yield start
        else:
            lastInclusive = int(parts[1])
            for i in range(start, lastInclusive + 1):
                yield i
