def compounding(start, stop, compound):
def clip(value):<EOL><INDENT>return max(value, stop) if (start > stop) else min(value, stop)<EOL><DEDENT>curr = float(start)<EOL>while True:<EOL><INDENT>yield clip(curr)<EOL>curr *= compound<EOL><DEDENT>
Yield an infinite series of compounding values. Each time the
    generator is called, a value is produced by multiplying the previous
    value by the compound rate.

    EXAMPLE:
      >>> sizes = compounding(1., 10., 1.5)
      >>> assert next(sizes) == 1.
      >>> assert next(sizes) == 1 * 1.5
      >>> assert next(sizes) == 1.5 * 1.5