[Python-Dev] Adding 'lexists()' to os.path

Guido van Rossum guido at python.org
Sun Aug 22 20:58:31 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?

Looks like you already got the go-ahead.  Just make sure with any API
changes/additions to os.path, that there are many individual *path
modules that need to be updated -- if a platform doesn't support
symlinks, lexists() should probably just be an alias for exists().

posixpath.py, ntpath.py, macpath.py, os2emxpath.py.

--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list