'Retrieve an iterator of all the ancestors of this path.
@return: an iterator of all the ancestors of this path, from the most
recent (its immediate parent) to the root of its filesystem.'

def parents(self):

    path = self
    parent = path.parent()
    while (path != parent):
        (yield parent)
        path = parent
        parent = parent.parent()
