A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-August/113389.html below:

[Python-Dev] Coding guidelines for os.walk filter

[Python-Dev] Coding guidelines for os.walk filter [Python-Dev] Coding guidelines for os.walk filterMichael Urman murman at gmail.com
Wed Aug 31 04:21:52 CEST 2011
> for t in os.walk(somedir):
>    t[1][:]=set(t[1])-{'.svn','tmp'}
>    ... do something
>
> This is a very clever hack but... it relies on internal implementation
> of os.walk....

This doesn't appear to be an internal implementation detail; this is
documented behavior.
http://docs.python.org/dev/library/os.html#os.walk shows a similar example:

    for root, dirs, files in os.walk('python/Lib/email'):
        # ...
        dirs.remove('CVS')  # don't visit CVS directories

-- 
Michael Urman
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4