Is there a `pathlib` equivalent of `os.scandir()`?

I would guess that these are relatively simple objects; e.g. they aren’t caching the stat, inode etc. results when created. Plus they’re implemented in C.

I just tried it and os.scandir was much faster for a directory that contained only a few files. It had so much of an advantage that [x.name for x in os.scandir()] (to get the result in the same format) is almost as fast as os.listdir().