[Python-Dev] Updates to PEP 471, the os.scandir() proposal
Ben Hoyt
benhoyt at gmail.com
Tue Jul 8 22:09:36 CEST 2014
More information about the Python-Dev mailing list
Tue Jul 8 22:09:36 CEST 2014
- Previous message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Next message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>> I think you're misunderstanding is_dir() and is_file(), as these don't >> actually call os.stat(). All DirEntry methods either call nothing or >> os.lstat() to get the stat info on the entry itself (not the >> destination of the symlink). > > > Oh. Extract of your PEP: "is_dir(): like os.path.isdir(), but much cheaper". > > genericpath.isdir() and genericpath.isfile() use os.stat(), whereas > posixpath.islink() uses os.lstat(). > > Is it a mistake in the PEP? Ah, you're dead right -- this is basically a bug in the PEP, as DirEntry.is_dir() is not like os.path.isdir() in that it is based on the entry itself (like lstat), not following the link. I'll improve the wording here and update the PEP. -Ben
- Previous message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Next message: [Python-Dev] Updates to PEP 471, the os.scandir() proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list