[Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator
Ethan Furman
ethan at stoneleaf.us
Sun Jun 29 19:02:16 CEST 2014
On 06/29/2014 05:28 AM, Nick Coghlan wrote:
>
> So, here's my alternative proposal: add an "ensure_lstat" flag to
> scandir() itself, and don't have *any* methods on DirEntry, only
> attributes.
>
> That would make the DirEntry attributes:
>
> is_dir: boolean, always populated
> is_file: boolean, always populated
> is_symlink boolean, always populated
> lstat_result: stat result, may be None on POSIX systems if
> ensure_lstat is False
>
> (I'm not particularly sold on "lstat_result" as the name, but "lstat"
> reads as a verb to me, so doesn't sound right as an attribute name)
+1
--
~Ethan~
More information about the Python-Dev
mailing list