Re: is anyone using return_folders in tools.Walk()?
"Will Guaraldi" <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
(taking jens and uche off the list--this is more of a pyblosxom-devel discussion). On 7/5/07, Ryan Barrett <[email protected]> wrote: > On Thu, 5 Jul 2007, Will Guaraldi wrote: > > > Are you sure about that? I didn't think the stat'ing was done in tools.Walk. > > Walk will walk the directory tree twice, but I don't see it stat'ing things. > > it calls os.path.isfile(), islink(), and isdir() (twice) on each result path > that os.listdir() returns. all of those most likely stat the underlying file > or directory, unless there's magic i'm unaware of. :P Oh, you're totally right. I thought you were talking about our filestat'ing. Yeah--that toolks.Walk is crazy! We should refactor that because it's silly that we're doing what we're doing. Two thoughts (off the top of my head): we should switch to os.walk (introduced in 2.3) or we should stat the thing ourselves and check the stat data to figure out whether it's a file or a dir or whatever. Personally, I'm voting for upping our Python requirement to 2.3 and switching to os.walk--I think it'll reduce the complexity of the code. /will ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/