Message 246092 - Python tracker (original) (raw)

May be slightly refactor the code?

def _select_from(self, parent_path, is_dir, exists, listdir):
    try:
        if not is_dir(parent_path):
            return
        yield from self._select_from2(parent_path, is_dir, exists, listdir)
    except PermissionError:
        return

def _select_from2(self, parent_path, is_dir, exists, listdir):
    ... # implementation