[Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator

Walter Dörwald walter at livinglogic.de
Sun Jun 29 10:23:42 CEST 2014


On 28 Jun 2014, at 21:48, Ben Hoyt wrote:

> [...]
>> Crazy idea: would it be possible to "convert" a DirEntry object to a
>> pathlib.Path object without losing the cache? I guess that
>> pathlib.Path expects a full  stat_result object.
>
> The main problem is that pathlib.Path objects explicitly don't cache
> stat info (and Guido doesn't want them to, for good reason I think).
> There's a thread on python-dev about this earlier. I'll add it to a
> "Rejected ideas" section.

However, it would be bad to have two implementations of the concept of 
"filename" with different attribute and method names.

The best way to ensure compatible APIs would be if one class was derived 
from the other.

> [...]

Servus,
    Walter


More information about the Python-Dev mailing list