[Python-Dev] os.path.walk generator

Martin v. Löwis martin@v.loewis.de
12 Dec 2002 18:41:04 +0100


Aahz <aahz@pythoncraft.com> writes:

> > walk2(topdir, hidden=None)
> > 
> > be added to os.path. It yields all the files and directories under (and 
> > including) "topdir". If "hidden" is true, then hidden files and 
> > directories are included.
> 
> python-dev is the wrong place for this discussion; you should post to
> comp.lang.python and/or submit a feature request to SourceForge.  Best
> of all, post a patch to SF.

I'd take this back a bit. python-dev is the wrong place to ask for new
features, yes. However, it is ok to ask "Might it be acceptable if I
implement it?", to which possible answers are "yes", "no", or "write a
PEP".

For that matter, I'd like to steer attention to
python.org/sf/619222. I think any walk modification should take file
types into account (a feature which isn't implemented, either). I hope
that Python adds support for file types one day, and it would be
unfortunate if that would cause introduction of walk3 and walk4.

Please take into consideration that the os.path.walk callback can
control traversal, by modifying the file list. It should be specified
if this is also supported for walk2.

Regards,
Martin