For a string "a.b.c", yields "a", "a.b", "a.b.c".

def dotted_parts(s):
    """
    For a string "a.b.c", yields "a", "a.b", "a.b.c".
    """
    idx = -1
    while s:
        idx = s.find('.', idx+1)
        if idx == -1:
            yield s
            break
        yield s[:idx]