I'd like to have a function that builds a list of files with os.walk() and then have other functions accept that list as a parameter and modify it as needed. For example, if the user has specified that certain files and folders be excluded from the walk, I'd like to have functions like this:
def build_list(path):
fs_list = os.walk(path)
return fs_listdef skip_files(fs_list):
remove files
return fs_listdef skip_dirs(fs_list):
remove dirs
return fs_listdef search(fs_list):
passThe problem I'm encountering is passing the list to other functions. It's almost as if each function needs to build the list itself (walk the filesystem)... which gets in the way of what I was asked to do (break this thing up into modular, maintainable pieces).
Any tips on this?
Thanks -- http://mail.python.org/mailman/listinfo/python-list
