[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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant