Message259282
Per Guido's comment about DirEntry documentation on Issue 26032, especially http://bugs.python.org/issue26032#msg257665, it'd be good to improve the docs of the scandir DirEntry methods with regard to symlinks and caching.
Attaching my stab at a documentation fix. Changes here are:
1) Clarify that the return values of is_dir()/is_file()/etc are cached separately for follow_symlinks True and False.
2) Be more specific about when the functions require a system call, and how it relates to caching and follow_symlinks.
3) DRY up common stuff between is_dir and is_file by saying "Caching, system calls made, and exceptions raised are as per is_dir" in is_file.
4) Tweak to the first paragraph of docs for is_dir/is_file to simplify: assume the follow_symlinks=True default, then note the follow_symlinks=False non-default case after.
I think they're all improvements, though I'm not sure about #3. Is it better to just repeat those couple of paragraphs verbatim?
I'm also not 100% sure about mentioning the DT_UNKNOWN thing. But you really can't get more specific about when system calls are required on Unix without mentioning it. |
|
Date |
User |
Action |
Args |
2016-01-31 16:43:42 | benhoyt | set | recipients:
+ benhoyt, gvanrossum, vstinner, docs@python, serhiy.storchaka |
2016-01-31 16:43:42 | benhoyt | set | messageid: <1454258622.6.0.285150622743.issue26248@psf.upfronthosting.co.za> |
2016-01-31 16:43:42 | benhoyt | link | issue26248 messages |
2016-01-31 16:43:41 | benhoyt | create | |
|