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

Jeff Epler jepler at unpythonic.net
Sun Aug 22 16:18:19 CEST 2004


On Sun, Aug 22, 2004 at 02:17:00PM +0100, Paul Moore wrote:
> As an alternative, would there be any value in cacheing the last stat
> result?

Well, code like this would break:

    def wait_for_change(filename, delay=.1):
        stamp = os.stat(filename).st_mtime
        while 1:
            time.sleep(delay)
            if os.stat(filename).st_mtime != stamp: break

Hm ... 
>>> import statcache
/usr/lib/python2.3/statcache.py:8: DeprecationWarning: The statcache module is obsolete.  Use os.stat() instead.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20040822/c4236a3d/attachment.pgp


More information about the Python-Dev mailing list