def decompress(compressed):
    return ''.join(decompress_gen(compressed))

def decompress_gen(compressed):
    start = 0
i = 0
while i < len(compressed):
    curr = compressed[i]
i += 1
if not curr in string.digits:
    num = 1 if start + 1 == i else int(compressed[start:i - 1])
yield ''.join(curr * num)
start = i
How can I analyze or improve my niece's simple compression algorithm that is based on Morse code?