This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author benhoyt
Recipients benhoyt, docs@python, serhiy.storchaka, vstinner
Date 2015-04-19.20:01:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429473711.62.0.571757122461.issue24013@psf.upfronthosting.co.za>
In-reply-to
Content
Victor Stinner's documentation for os.scandir and DirEntry is a great start (https://docs.python.org/dev/library/os.html#os.scandir), however there are a few mistakes in it, and a few ways I think it could be improved. Attaching a patch with the following overall changes:

1. Tweak the "see also" note on os.listdir() to mention *why* you'd want to use scandir -- namely that it includes file attribute info, and performance.
2. Move that str/bytes note in the scandir() docs down a bit, as I think that's really a detail and the other stuff is more important.
3. More details on why you'd want to use scandir -- to "increase the performance of code that also needs file type or file" -- and be more specific about what system calls are and are not required.
4. Replace "POSIX" with "Unix", per the rest of the os module docs when talking about generic Unix-like operating systems. It seems "POSIX" is used specifically when talking about the POSIX standard.
5. Remove half-true statement in DirEntry docs, "if a file is deleted between calling scandir and stat, a FileNotFoundError can be raised" -- but the method docs state that they specifically don't raise FileNotFoundError.
6. Removed "unfortunately, the behaviour of errors depends on the platform". This is always the case and doesn't add anything.
7. Tried to simplify and clarify the is_dir() and is_file() docs. Not sure I've succeeded here. This is hard!
8. Added "Availability: Unix, Windows." to scandir docs like listdir and most other os functions have.
9. Remove the see also about how "the listdir function returns the names of the directory entries" as that's already stated/implied above.
History
Date User Action Args
2015-04-19 20:01:51benhoytsetrecipients: + benhoyt, vstinner, docs@python, serhiy.storchaka
2015-04-19 20:01:51benhoytsetmessageid: <1429473711.62.0.571757122461.issue24013@psf.upfronthosting.co.za>
2015-04-19 20:01:51benhoytlinkissue24013 messages
2015-04-19 20:01:51benhoytcreate