Re: postprocessing in os.walk

2009-10-13 Thread Ethan Furman
kj wrote: In Dave Angel writes: [snippetty snip] Why would you need a special hook when the os.walk() generator yields exactly once per directory? So whatever work you do on the list of files you get, you can then put the summary logic immediately after. I think you're missing the p

Re: postprocessing in os.walk

2009-10-13 Thread Dave Angel
Peter Otten wrote: kj wrote: In Dave Angel writes: kj wrote: Perl's directory tree traversal facility is provided by the function find of the File::Find module. This function accepts an optional callback, called postprocess, that gets invoked "just before leaving the curren

Re: postprocessing in os.walk

2009-10-13 Thread Paul Rubin
kj writes: > I think you're missing the point. The hook in question has to be > called *immediately after* all the subtrees that are rooted in > subdirectories contained in the current directory have been visited > by os.walk. > > I'd love to see your "5 lines" for *that*. I'm having trouble un

Re: postprocessing in os.walk

2009-10-13 Thread Peter Otten
kj wrote: > In Dave Angel > writes: > >>kj wrote: >>> Perl's directory tree traversal facility is provided by the function >>> find of the File::Find module. This function accepts an optional >>> callback, called postprocess, that gets invoked "just before leaving >>> the currently processed d

Re: postprocessing in os.walk

2009-10-13 Thread kj
In Dave Angel writes: >kj wrote: >> Perl's directory tree traversal facility is provided by the function >> find of the File::Find module. This function accepts an optional >> callback, called postprocess, that gets invoked "just before leaving >> the currently processed directory." The docum

Re: postprocessing in os.walk

2009-10-12 Thread Dave Angel
kj wrote: Perl's directory tree traversal facility is provided by the function find of the File::Find module. This function accepts an optional callback, called postprocess, that gets invoked "just before leaving the currently processed directory." The documentation goes on to say "This hook is

postprocessing in os.walk

2009-10-12 Thread kj
Perl's directory tree traversal facility is provided by the function find of the File::Find module. This function accepts an optional callback, called postprocess, that gets invoked "just before leaving the currently processed directory." The documentation goes on to say "This hook is handy fo

Re: postprocessing in os.walk

2009-10-11 Thread jordilin
Well, you could use the alternative os.path.walk instead. You can pass a callback as a parameter, which will be invoked every time you bump into a new directory. The signature is os.path.walk (path,visit,arg). Take a look at the python library documentation. On 11 Oct, 00:12, kj wrote: > Perl's