This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jacek.Pliszka
Recipients Jacek.Pliszka
Date 2011-08-20.11:52:53
SpamBayes Score 7.62003e-07
Marked as misclassified No
Message-id <1313841174.16.0.821458772727.issue12793@psf.upfronthosting.co.za>
In-reply-to
Content
I suggest a small change in os.walk module.  

Instead of:
def walk(top, topdown=True, onerror=None, followlinks=False):

I would like to have:
def walk(top, topdown=True, onerror=None, skipnames=lambda x : False, skipdirs=islink):

Implementation might be as follows:

<         if isdir(join(top, name)):
---
>         fullname=join(top, name)
>         if skipnames(fullname):
>             continue
>         if isdir(fullname):

and:

<         if followlinks or not islink(new_path):
<             for x in walk(new_path, topdown, onerror, followlinks):
---
>         if not skipdirs(new_path):
>             for x in walk(new_path, topdown, onerror, skipnames, skipdirs):

This is a small change, breaks a bit 'followlinks' option but gives
much more flexibility as skipnames and skidirs can be any 
functions (including ones using regexp and similar).
History
Date User Action Args
2011-08-20 11:52:54Jacek.Pliszkasetrecipients: + Jacek.Pliszka
2011-08-20 11:52:54Jacek.Pliszkasetmessageid: <1313841174.16.0.821458772727.issue12793@psf.upfronthosting.co.za>
2011-08-20 11:52:53Jacek.Pliszkalinkissue12793 messages
2011-08-20 11:52:53Jacek.Pliszkacreate