[Python-Dev] Adding 'lexists()' to os.path
Johannes Gijsbers
jlgijsbers at planet.nl
Sun Aug 22 13:08:35 CEST 2004
I was just reviewing the patch at http://python.org/sf/941486, which proposes
adding a new 'lexists()' function to os.path. This function would return True
for dangling symbolic links, unlike os.path.exists() which returns False. One
could use 'os.path.islink(path) or os.path.exists()' as well, but that's two
stat calls instead of one.
This function is useful and efficient for fixing a bug in glob.py (which the
patch does as well) and it seems like it could be useful in tarfile.py and
tempfile.py as well. Also, a high-quality patch is already available. So, any
objections to adding this to os.path?
Johannes
More information about the Python-Dev
mailing list