Uwe Kleine-König added the comment:

I like the function as it is documented, i.e. "filenames is a list of the names 
of the non-directory files in dirpath.". This includes all symlinks (in the 
followlinks=False cast at least).

I'd say not including symlinks to directories but symlinks to files is a 
magnitude more surprising than treating a symlink to a directory as a file. And 
if you consider this as a short comming of the documentation this isn't (IMHO) 
a subtlety. The (my?) intuition says: all entries of a root (apart from . and 
.. as documented) are included in either dirnames or filenames.

Yes, changing behaviour here might break some code, but this applies to all 
changes.

For some usecases it might be right to just skip over symlinks-to-dirs, but if 
it's not you have to opendir + read all root entries again in the loop to find 
all symlinks which effectively means reimplementing os.walk.

----------
nosy: +ukl

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12970>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to