I am finding that I often need to pass the path around with a DirEntry. It would be nice to be able to just pass around DirEntry objects as they already contain the path as a private attribute. Making it read-only seems acceptable, in which case the lstat caching wouldn't get any more complicated.
Interesting. I didn't expose that partly because the Windows DirEntry doesn't actually have it at all (even as a private attribute). Is it the path (base directory) that you're actually after, or the full path name of the file, as in os.path.join(path, entry.name)? I ask because I could make str return the full filename, so that str(entry) works as per the new pathlib standard library module (Python 3.4).
Either the base directory or the full path would be fine for my purposes. Getting the full path when converting to a string sounds good too. Thanks!
Just an update -- in the python-dev discussion on PEP 471, it looks like there's general support for this as a .full_name attribute. I'll keep you posted.
This is now the DirEntry.full_name attribute, included in scandir version 0.6 which I just uploaded to PyPI.