def iexplode_path(path):
    """Iterate over all the parts of a path.
    Splits path recursively with os.path.split().
    """
    (head, tail) = os.path.split(path)
    if not head or (not tail and head == path):
        if head:
            yield head
        if tail or not head:
            yield tail
        return
    for p in iexplode_path(head):
        yield p
    yield tail
Iterate over all the parts of a path.
    Splits path recursively with os.path.split().
    
src/globmatch/pathutils.py