[Python-Dev] Remaining decisions on PEP 471 -- os.scandir() (original) (raw)

Victor Stinner victor.stinner at gmail.com
Mon Jul 14 10:25:48 CEST 2014


2014-07-14 4:17 GMT+02:00 Nick Coghlan <ncoghlan at gmail.com>:

Or the ever popular symlink to "." (or a directory higher in the tree).

"." and ".." are explicitly ignored by os.listdir() an os.scandir().

I think os.walk() is a good source of inspiration here: call the flag "followlink" and default it to False.

IMO the specific function os.walk() is not a good example. It includes symlinks to directories in the dirs list and then it does not follow symlink, it is a recursive function and has a followlinks optional parameter (default: False).

Moreover, in 92% of cases, functions using os.listdir() and os.path.isdir() follow symlinks: https://mail.python.org/pipermail/python-dev/2014-July/135435.html

Victor



More information about the Python-Dev mailing list