Johannes Gijsbers <jlgijsbers at planet.nl> writes: > 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. As an alternative, would there be any value in cacheing the last stat result? In a sequence like this, with multiple calls for the same argument, many stat calls would be replaced by one. And it's likely that the checking overhead on cache misses would be minimal compared to the cost of the stat call, so it's an overall win. Of course, actual tests beat idle speculation like this... Paul. -- Any sufficiently advanced technology is indistinguishable from magic. -- Arthur C. Clarke
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4