[Python-Dev] Scandir module's C code updated to Python 3.5 code

Ben Hoyt benhoyt at gmail.com
Fri May 15 21:30:34 CEST 2015

Hi folks,

With os.scandir() now in the Python 3.5 stdlib, I just thought I'd let
folks know that I've released the scandir module version 1.0. So this
is now basically a copy-n-paste of the C code that went into CPython
3.5's posixmodule.c with the necessary changes to make it work or
Python 2.x (2.6+).

You can use the following import to pick os.scandir/os.walk if on
Python 3.5+ or the scandir module version otherwise:

        from os import scandir, walk
    except ImportError:
        from scandir import scandir, walk

I've tested it and it all looks good and performs well, but please let
me know if you have any issues!

* PyPI: https://pypi.python.org/pypi/scandir
* Github project: https://github.com/benhoyt/scandir

Would love to hear any success/speedup stories, too!


More information about the Python-Dev mailing list