> In the python-ideas list there's a thread "PEP: Extended stat_result" > about adding methods to stat_result. > > Using that, you wouldn't necessarily have to look at st.st_mode. The method > could perform an additional os.stat() if the field was None. For > > example: > > # Build lists of files and directories in path > files = [] > dirs = [] > for name, st in os.scandir(path): > if st.is_dir(): > dirs.append(name) > else: > files.append(name) That's not too bad. However, the st.is_dir() function could potentially call os.stat(), so you'd have to be specific about how errors are handled. Also, I'm not too enthusiastic about how much "API weight" this would add -- do you need st.is_link() and st.size() and st.everything_else() as well? -Ben
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