Pruning with os.scandir?

Stephen Kennedy muchomojo at gmail.com
Thu Aug 6 12:45:57 CEST 2015


I just saw PEP 471 announced. Mostly it looks great! One thing I found puzzling though is the lack of control of iteration. With os.walk, one can modify the dirs list inplace to avoid recursing into subtrees (As mentioned somewhere, in theory one could even add to this list though that would be a strange case).

I can't see how to do this with os.scandir. I hope I am missing something? Don't make me walk the entire contents of .git, tmp and build folders please.

Stephen.


More information about the Python-list mailing list