[issue26781] os.walk max_depth

2017-07-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I think there is a little need in this feature. I concur with Serhiy and think we're better-off without this proposal. Marking this as closed. -- nosy: +rhettinger resolution: -> rejected stage: -> resolved status: open -> closed ___

[issue26781] os.walk max_depth

2017-07-17 Thread André Rossi Korol
André Rossi Korol added the comment: I proposed a new function called lwalk(level walk) that recurses only to a certain level of depth: http://bugs.python.org/issue30942 It is implemented in os.py and calls os.walk, but making sure it recurses only to a selected level of depth. If it is accepte

[issue26781] os.walk max_depth

2016-04-20 Thread Aviv Palivoda
Aviv Palivoda added the comment: I am not sure about the wide use of this feature but I do think this is a nice feature to add to os.walk. I can see how you can implement is_too_deep by counting the number of separators in the path. However I don't think it is trivial to do that. In addition d

[issue26781] os.walk max_depth

2016-04-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: os.walk() allows more flexible control. for root, dirs, files in os.walk(top): if is_too_deep(root): dirs.clear() continue ... You can even walk up to different depth on different parts of the tree. You can limit w

[issue26781] os.walk max_depth

2016-04-16 Thread Aviv Palivoda
Changes by Aviv Palivoda : Added file: http://bugs.python.org/file42494/os-walk-max-depth-2.patch ___ Python tracker ___ ___ Python-bugs-list

[issue26781] os.walk max_depth

2016-04-16 Thread random832
random832 added the comment: Wouldn't the "symlink infinite loop" case be better handled by making it track where it's already been? This can be done by inode and dev number on Unix; I'm not sure what equivalent exists on Windows (though symlinks are uncommon on Windows) but you could fall bac

[issue26781] os.walk max_depth

2016-04-16 Thread Aviv Palivoda
New submission from Aviv Palivoda: I am suggesting to add max_depth argument to os.walk. I think this is very useful for two cases. The trivial one is when someone wants to walk on a directory tree up to specific depth. The second one is when you follow symlinks and wish to avoid infinite loop