A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-July/135427.html below:

[Python-Dev] Updates to PEP 471, the os.scandir() proposal

[Python-Dev] Updates to PEP 471, the os.scandir() proposalBen Hoyt benhoyt at gmail.com
Wed Jul 9 23:33:12 CEST 2014
> On a system which did not supply is_dir automatically I would write that as:
>
>   for entry in os.scandir(path):  # info defaults to 'os', which is
> basically None in this case
>       if ignore_entry(entry.name):
>           continue
>       if os.path.isdir(entry.full_name):
>           # do something interesting
>
> Not hard to read or understand, no time wasted in unnecessary lstat calls.

No, but how do you know whether you're on "a system which did not
supply is_dir automatically"? The above is not cross-platform, or at
least, not efficient cross-platform, which defeats the whole point of
scandir -- the above is no better than listdir().

-Ben
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4