Re: walk() in module posixpath

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Fri, 17 Jun 1994 13:19:06 -0400

On Jun 17, 17:31, "N.G.Smith" wrote:
>
> The walk() function in module posixpath will walk through symlinks to
> directories. This causes big problems with circular links. Is this the
> intended behaviour?
>
> Would making the penultimate line...
>
> if isdir(name) and not islink(name):
>
> ...break sensible applications?
>

Quote:

"The visit function may modify names to influence the set of
directories visited below dirname, e.g., to avoid visiting
certain parts of the tree. (The object referred to by names
must be modified in place, using del or slice assignment.)"

i.e. I think the intent is (and should be) to hand you the complete
list and have your 'visit' function do any filtering. Changing walk
to do this prefiltering would break applications that want to search
down symbolic links. ( Even if there *are* circular references, the
search may end by some other criteria. )

But, maybe that's enough of a "gotcha" to merit a note in that
entry of the Library References manual.

- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics